[Pythonmac-SIG] Okay folks--show me how and I'll write it up...

Jack Jansen Jack.Jansen@oratrix.com
Thu, 28 Nov 2002 21:23:27 +0100


On donderdag, nov 28, 2002, at 12:40 Europe/Amsterdam, Michael J. 
Barber wrote:

> On Thursday, November 28, 2002, at 10:27  AM, Jack Jansen wrote:
>
>>
>> On woensdag, nov 27, 2002, at 22:36 Europe/Amsterdam, Daniel Lord 
>> wrote:
>>
>>> [Daniel wants to script iTunes]
>> Osam is really a stopgap. The preferred way to control OSA 
>> applications  from Python is to use the fullblown OSA interface, this 
>> gives you  complete access to all features from Python, in a 
>> "pythonic" way.  Unfortunately you first have to create the interface 
>> module for the  specific program you want to control. This is done 
>> with  Mac/scripts/gensuitemodule.py. For some common applications the 
>> suites  are pre-generated, you'll find these in 
>> Mac/Lib/lib-scriptpackages.
>>
>> There is some minimal documentation, see Mac/Demo/applescript.html.
>>
> I would like very much to agree with this suggestion, but I just tried 
> it out and gensuitemodule doesn't let me select iTunes as a "package 
> generation target."

Try selecting the file iTunes.app/Contents/Resources/iTunes.rsrc. Some 
OSX applications have their AETE resource in there (Terminal is an 
example). Some other apps, however, have no AETE resource, but in stead 
have their applescript dictionaries encoded in plist files. At the 
moment you are out of luck if you want to script one of these.

If I understand things correctly, however, there should be a API call 
to get the AETE resource of a given application (or maybe present the 
user with a dialog allowing selection of such an app, and then getting 
its AETE), either from the file or from a running process. If anyone 
knows how this works: please explain.
I assume this is somewhat like the dialog Script Editor shows when you 
ask it to open a dictionary.

Or, even better, adapt gensuitemodule to use this method to get at the 
AETE (I have enough on my plate, really).
> --
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -