Using Apple Script GUI / UI Scripting as a Proxy for AppleScript Support in Apple iWork Numbers ‘08
August 21st, 2007 | by Michael |Numbers user Marcus Wilhoit was the first person that I came across describing using AppleScript’s GUI support for user interface (UI) scripting, to compensate for the lack of AppleScript support in Numbers ’08.
He describes it this post on Apple Discussions forum:
http://discussions.apple.com/thread.jspa?threadID=1090948&tstart=0
Basically, the method allows a user to interact with the Numbers application by scripting commands that a user would normally give via the mouse or keyboard. For instance, take a look at this bit of AppleScript:
tell application “Numbers”
activate
end tell
tell application “System Events”
tell process “Numbers”
tell menu bar 1
tell menu bar item “Edit”
tell menu “Edit”
click menu item “Paste”
end tell
end tell
end tell
end tell
end tell
return true
This tells the OS to launch Numbers, bring the program into focus, click edit from the menu bar, and then paste from the menu bar.
You can script virtually any GUI element. I think this allows for some much needed options on the Numbers automation front. You can find documentation on AppleScript GUI Scripting here:
http://www.apple.com/applescript/uiscripting/index.html
I hope to create some projects using this methodology in the future, and it also gives me a reason to learn AppleScript! If you are interested in pushing Numbers to its limits and beyond, be sure to check out Marcus’s post.
Marcus also shared via e-mail that he was working on some new tools using this process. Keep up the good work!









3 Responses to “Using Apple Script GUI / UI Scripting as a Proxy for AppleScript Support in Apple iWork Numbers ‘08”
By Joe on Sep 3, 2007 | Reply
Coming from MS Excel (and PCs for over 2 decades), I had high hopes for Numbers. The lack of a Macro language and VBA is a big negative. I don’t know anything (yet) about Apple Script, but I look forward to learning.
If Apple gets truly serious about Numbers, it could be a HUGE loss for Microsoft.
By KOENIG Yvan on Sep 4, 2007 | Reply
Hello
The given script is verbose and linked to the english version.
Here is one which is shorter and localisation independent.
–SCRIPT
tell application “Numbers” to activate
tell application “System Events” to tell process “Numbers” to keystroke “v” using command down
–[/SCRIPT]
I wish to add that at the very beginning of this site, the application’s name is mispelled.
You wrote iWorks but it is iWork
Yvan KOENIG
By Neil on Oct 31, 2007 | Reply
KOENIG Yvan
You misspelled the word misspelled.
Neil