[Pythonmac-SIG] Applescript equivalent in appscript
Jordan Baker
hexsprite at gmail.com
Sat Jun 7 21:52:05 CEST 2008
On 7-Jun-08, at 3:14 PM, Daniel Lord wrote:
>
> On Jun 7, 2008, at 11:48 AM, Rajanikanth Jammalamadaka wrote:
>
>> Suppose the application pops up a window while its running and gives
>> me two choices: Ok or Cancel
>> how can I tell it to select the Ok option always?
>
> I don't have time to work up a demo right now, but you should be
> able to use System Events:
>
> Apple info: http://www.apple.com/applescript/uiscripting/
Here's a blog post that has a Python example you can use:
http://hexsprite.blogspot.com/2008/03/testing-osx-applications-with-python.html
Heres some random snippets of code from a test that may or may not be
useful that manipulate a file open dialog.
myapp.windows['Choose a Folder'].sheets[1].buttons['Go'].click()
myapp.windows['Choose a Folder'].buttons['Choose'].click()
Have fun,
-jordan (hexsprite)
More information about the Pythonmac-SIG
mailing list