[Pythonmac-SIG] AppleEvent examples
Bill Bedford
billb@mousa.demon.co.uk
Mon, 12 Aug 2002 22:51:00 +0100
At 5:29 pm +0200 12/08/02, Jack Jansen wrote:
>
>Do you think you could add something to the findertools module that
>uses objects? Because that's the bit that *I* wouldn't mind having a
>manual for, I always forget how to say "set font of word 2 of
>paragraph 3 of window "Foo" to "Times Roman"" in Python.
The way I remember it is
Commands in applescript are methods of the application class in python.
Properties in applescript are classes of the application module in python
Which has always seemed to me to be a bit counter intuitive
So your example for application 'App' would be
ap = App.App()
ap.set(App.font(App.word(2, App.paragraph(3, App.window("Foo")))),
'to'='Times Roman')
That's assuming that 'font', 'word', 'paragraph' and 'window' are all
classes of App. For some applications this would not be true and the
classes have to be called from Standard Suites.
--
Bill Bedford
A streaker streaks, and a nation shrugs at a saucer like disk in the sky
A stag weekend is a poor weekend if the army is not on standby