From AlphaWiki

Main: AlphaTcl and helpers

Various new possibilities for interacting with other applications particularly on MacOS X (and Windows/Unix), now exist with Alpha(tk). However, AlphaTcl doesn't yet take advantage of all this in a seamless way, and neither is there good documentation on this.

Frédéric's 'xserv' is one step forwards, as are various other code snippets on the alpha-D list. This page is to collect, discuss and refine these (and hopefully result in code ending up in AlphaTcl).


<JK 20/09/2003> The remarks, citations, and code snippets previously found on this page were quite specialised and I have moved them to more specific pages (see below). I have written a new page AlphaAndUnix which contains general considerations about interaction with unix programmes (many of which can be thought of as helpers if you like). That page is an umbrella for the following more specialised pages:

And finally the page which is somehow the outcome of all this discussion:

These pages describe various possibilities using pipes. One can also use sockets, as Frédéric has done in 'InSh'. I don't really understand this, but I have collected various considerations (many of which taken from Alpha-D) on the page [Sockets]. Perhaps one day that page will grow into something more structured and authorative...

(There is also an interesting page on AlphaXTkAndRInOSX which fits into this subject.)


AppleEvents and AppleScripts

Just a pointer:

Just the observation that with System Events ( ) it is possible to script OSX GUI applications even if they haven't got an AppleScript dictionary. Instead you can generate fake button clicks, reaching any UI element of the application. This is recent AppleScript technology --- it was patiently explained to me by Philip Aker.

Now you can drive all this from Alpha using exec osascript. This is dead slow, but it works. And soon, Tclapplescript (or more generally TclOSAScript) should be available for OSX --- then it will all be much smoother. At some point I will put a page together on such experiments...


xserv

There ought to be more wiki information on 'xserv'... There are some things to learn there, before you really can take advantage of it...


Some snippets previously found on this page

The observations from Geoffrey Vallis on 'TeX inverse search' and 'TeX Forward Search' have been moved to [Interaction with TeX (under UNIX)]. Note also that these issues have been discussed intensively on the MacOSX-TeX mailing list in september 2003 under the name 'synchronicity'. You can search the list archives at http://www.esm.psu.edu/mac-tex/MacOSX-TeX-Digests/ .


Discussions of TeX interaction using pipes is described on the page [Interaction with TeX (under UNIX)]. The code snippet from http://www-math.unice.fr/~kock/alpha-tcl/newComm.tcl.gz with Juan's patches are outdated and have been removed. The outdated version can still be found in standard AlphaTcl!

(Two questions were left open from the previous version of this page:

Question: Is there any reason this uses 'exec /bin/cp' instead of 'file copy -force', etc?

Answer: pure ignorance (JK). Thanks for pointing this out.

Question: Why do you have to use '|open /bin/sh'? Can't you just open the actual tex command directly? Any sub-process will inherit Alpha's 'pwd' and $env(PATH) anyway, so those can just be set inside Alpha.

Answer (JK): It is sometimes necessary to redirect stderr or retrieve error codes. For example, through /bin/sh you can do 2>&1 --- and simply treat errors as output. If you do this directly in a pipe, the pipe will die because of non-zero exit status, even if stderr is redirected. Well, while writing this I suddenly don't feel too sure, but I am sure there were some cases where definitly it worked through /bin/sh and not through a simple pipe. (At some point in the phase of experimentation, using [[open |/bin/sh RDWR]] was a crucial trick (I learned it from Frédéric) --- it seems that some programmes are just much happier when they think they have their feet in a shell than when they run only attached to a pipe... I think we should keep this trick in memory for the time being...)


For the check-as-you-type spellchecker (posted on Alpha-D on 31/07/2003), see the page Features.SpellChecking.

Retrieved from http://alphatcl.sourceforge.net/wiki/pmwiki.php/Main/AlphaTclAndHelpers
Page last modified on October 02, 2008, at 08:03 PM