[Pythonmac-SIG] How to click on a Mac OS X button using python
David Warde-Farley
dwf at cs.toronto.edu
Sun Aug 24 08:58:31 CEST 2008
On 23-Aug-08, at 12:05 AM, murali krishna wrote:
> Hi,
> Can anyone tell how to click on a MAC OS X button using python
> script...I can do that easily in Windows but i have no clue to do it
> on Mac.
Hi Murali,
You really needn't send three messages to the list within he span of
two hours. This isn't a terribly high traffic list and people will get
back to you. Your message was also marked as spam for at least me,
possibly due to the fact that you sent an HTML message, which is bad
mailing list karma. Two "ping" messages in two hours might be
appropriate on some web bulletin boards but it is certainly not
appropriate here.
To answer your question, almost all applications on Mac OS X are
scriptable via AppleScript (which can be accessed from Python, with
Python syntax, with the appscript module - http://appscript.sourceforge.net/
).
If the app exposes a scripting interface for the specific action that
this button performs, you can use that. Open up the application in
Script Editor with "File->Open Dictionary..." and take a look at what
actions the app exposes. This is a good way of making sure your script
does what you think it should do even if things about that button
change in the future.
If what you want to do is not in the dictionary for the app you're
hoping to script, what you'll need to look into is GUI scripting. http://www.apple.com/applescript/uiscripting/
This exposes AppleScript support for "clicking a button" and things
like that. Note that you need to have it enabled in the Universal
Access preference pane.
Good luck, and please be more patient with your messages in the future.
David
More information about the Pythonmac-SIG
mailing list