[Pythonmac-SIG] ANN: aeve 0.0.3 - Pythonic Apple Event Support
Bob Ippolito
bob at redivi.com
Wed Sep 10 04:34:33 EDT 2003
For those of you that like yourselves too much to attempt
gensuitemodule, I've been working on a replacement that's a few orders
of magnitude easier to use. Basically, this lets Python do most things
you could do from Script Editor in a very dynamic way.
You can fetch it at (you need this for the examples / scripts at the
moment):
http://undefined.org/python/aeve-0.0.3.tgz
Or install from my PackageManager repository (which will download the
dependencies):
http://undefined.org/python/pimp/darwin-6.6-Power_Macintosh.plist
Changes from 0.0.2:
aeve is now dependent on the following modules:
LaunchServices ( http://undefined.org/python/ )
TECManager ( http://undefined.org/python/ )
PyObjC ( http://pyobjc.sourceforge.net/ )
the compiler and aeve.talkto will now take just about any identifying
information for an application, here are some useful examples (using
iTunes):
iTunes # application name
com.apple.iTunes # bundle identifier, I personally prefer this over
the application name
/Applications/iTunes.app # path name, though there really isn't a need
to use this anymore
hook # creator code
The example scripts have changed slightly to show this new feature
The arguments for the compiler script have changed (now will only take
debug or verbose as arguments)
I changed a bunch of the logic around internally, but I plan on making
a rather big change when I get the time so it does more magic with
AERecords. This is one of the only weak points of aeve at the moment.
It's a lot more compatible with applications, such as BBEdit and iView
MediaPro, which did not work previously.
aeve does not require you to spit out a bunch of py files before
talking to an app, it's as easy as this:
it uses unicode pretty much everywhere, all the time. it uses
TECManager to convert all of the text coming in from AppleScript and in
the terminologies from macroman (or whatever script+language) into
unicode. The HTML documentation prints out with this unicode goodness
as well.
A whole lot of nasty code was rewritten (it doesn't really bear much
resemblance to gensuitemodule anymore)
import aeve
iTunes = aeve.talkto('com.apple.iTunes')
print iTunes.current_track.name
Of course, for those great applications that have broken aevt
dictionaries, you can use the compiler to generate .py files, like this:
cd aeve/scripts
./compiler.py com.apple.iTunes
Which will spit out a python package called iTunes, with all of the
relevant .py files. It's not quite pretty printed, but it's good
enough to fix things (for example, adding the undocumented artwork
element to the track class).
html documentation can be generated in much the same manner, here's an
example:
http://undefined.org/python/aeve/iTunes_doc/
As you can tell, I was pretty uninspired and copied the look and feel
of Script Editor's dictionary. This documentation was spit out with
the following:
cd aeve/scripts
./aevedoc.py /Applications/iTunes.app
There are currently two example scripts included:
missingTrackFinder.py - seeks out and destroys file tracks in your
playlist whose file is missing (there are plenty of status and question
dialogs, so it's pretty safe)
spamStatusMessage.py - a little script I've been using to set my iChat
status message to the number of spams I've filtered _that day_. I
changed it so it will look in your default junk mail folder (by
inspecting your junk mail rule). I don't think this will work with
Panther's Mail.app, but it does work with Jaguar's.
If you get a chance to play with aeve, I'm looking for feedback/bug
reports - especially from those of you that have used or are using
gensuitemodule, or have never used Apple Events.
-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3792 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20030910/dd4fb16e/attachment-0001.bin
More information about the Pythonmac-SIG
mailing list