Tcl® enables Tcl applications on the Macintosh to use AppleEvents for
communication with other programs and for the AppleEvent Manager to
communicate with Tcl applications. The nature of the MacOS (at least prior
to MacOS X) makes it impossible to implement any meaningful
exec
command. Between agreeable applications,
AppleEvents allow communication of anything that can be passed as an
argument to a command-line application and much more. The key is to make
the applications agreeable. Tcl® is an attempt to get Tcl to support its
end of the bargain. Tcl® is complementary to Jim InghamÕs
Tclapplescript.shlb (included in the Tcl distributions). Depending on your
task and your relative familiarity with AppleScript and raw AppleEvents,
you may find one tool or the other preferable.
Tcl® inherits directly from the AppleEvent facilities in the Alpha text editor, as written by Pete
Keleher and Tim Endres. For many years, Alpha has used Jens AlfkeÕs AEGizmos to render the
pathologically-typed binary data in AppleEvents into a Tcl-manageable
string form. Unfortunately, while AEGizmos are reasonably easy for humans
to read, they're not the most convenient format for a computer to
interpret. Alpha programmers wishing to interact with other programs have
generally applied regular expressions to these strings (with varying
degrees of success), in order to extract the information they were
interested in. Several years ago, I got tired of writing the same
regexp
expressions and sanity checks over and over, so I set
out to write a complete AEGizmo parser. This parser, in one form or
another, has been a part of Alpha for a few years.
While this Tcl-based AEGizmo parser works well, it can be incredibly slow. A while back, a small group of AlphaÕs users and I formed the Alpha Cabal to assume development tasks from AlphaÕs originator, Pete Keleher (Pete has irresponsibly decided to procreate and pursue tenure, rather than work on Alpha like heÕs supposed to). One of my prime interests was in improving AlphaÕs AppleEvent capabilities. After some initial efforts at speeding up the parser, my dain bramage cleared up and I set out to simply expose as much of the AppleEvent Manager API to Tcl as possible. By avoiding the parsing step, speedups of a hundred-fold are typical. As the project progressed, it became clear that this could be a useful tool for any Tcl-based program, so I generalized the shared library to work with any Tcl 8 installation, and Pete generously agreed to let me open-source what was left of his code. Many of the design decisions in Tcl® (see Memory Leaks) reflect the need to achieve (nearly) the same results with Alpha 7, Alpha 8, and Wish.
You can download the latest version of Tcl® from SourceForge.
Place TclAE.shlb where Tcl can find it, such as in one of the directories
of $tcl_library
or in the same folder as the application.
Invoke the library by calling package require tclAE
.
Ever since version 8, Alpha will not work properly if Tcl® is not installed.
Tcl® has been predominantly tested with Tcl 8.4. It may work with other versions, but certainly none before Tcl 8.0.
Tcl® uses the Tcl Extension Architecture (TEA) and should build cleanly on recent Mac OS X machines (certainly works on Intel and PPC Tiger machines, and may build on older OSes). Xcode 2.4 is recommended; older than 2.2 won't work.
$ svn co http://tclae.svn.sourceforge.net/svnroot/tclae/trunk tclae
$ mkdir -p build; cd build
$ export CFLAGS='-Wno-deprecated-declarations -mmacosx-version-min=10.2 -arch ppc -arch i386'
$ ../tclae/configure --libdir=/Library/Tcl
$ make -j 2
$ sudo make install
$ make install DESTDIR=`pwd`/../install/
$ make test
Although not a requirement of use, please send me any of your changes so that I can incorporate them.
[tclAE::remoteProcessResolverGetProcesses]
[tclAE::send]
accepts AEAddresses.
[tclAE::launch]
and
[tclAE::processes]
.
typeUnicodeText
and
typeUTF8Text
.
.tcl
and .shlb
versions
Copyright © 1999Ð2007 Jonathan E. Guyer, Daniel Steffen, Peter J. Keleher
and Tim Endres.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Last modified Thursday, January 10, 2008 10:18:04 PM
|