[Pythonmac-SIG] AppleEvents in MacPython 2.3?
bob at redivi.com
Mon Aug 11 15:29:13 EDT 2003
Try aeve .. from http://undefined.org/python/
textedit = aeve.talkto('/Applications/TextEdit.app')
Currently, I think aeve just coerces text to a python string and
doesn't give you access to asking for paragraph/word/etc. I'll
probably change that in the future.
The only reason the "word" stuff works is because AppleScript handles
that stuff internally
On Monday, Aug 11, 2003, at 14:13 America/New_York, Stonewall Ballard
> I've been trying out Python for a few weeks, and have decided to
> convert to
> it for scripting. I had been using Perl and AppleScript for scripting.
> on OS X 10.2.6.
> I spent many hours yesterday trying to figure out how to use the
> support that comes with MacPython 2.3, and wasn't able to make much
> progress. Even a simple script like this:
> tell application "TextEdit"
> get word 1 of document 1
> end tell
> doesn't work. I guess I'm missing some understanding of how this works,
> since according to ScriptDebugger, "word" isn't an element of
> "document" in
> the first place. But somehow it works in AppleScript. Can anyone
> It would be really nice to have something that works like the MacPerl
> "doScript" command, which takes a string, compiles it as an
> AppleScript, and
> runs it. It's much easier to figure out how to drive AppleScriptable
> that way. Perhaps it's slower than sending apple events directly, but
> for my
> purposes, that doesn't matter.
> The archives of this group suggest that such a "doscript" facility
> used to
> exist, but I don't see it anywhere. Can someone tell me where I can
> this if it exists?
> It would also be very helpful to see examples of Python sending Apple
> Events. The doc example is too trivial to help much. I'd greatly
> any source code that you all might want to share.
> Thanks for any help.
> - Stoney
> Stonewall Ballard
> stoney at sb.org http://stoney.sb.org/
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
More information about the Pythonmac-SIG