AppleScript or Automator to click a menu in an application?

I'm not sure if this is possible using AppleScript and / or Automator ... but I would like to be able to:

a) run the application (I know that this can be done quite easily by AppleScript or Automator)

b) after starting the application, use AppleScript or Automator to select certain menu items.

eg. I would like to run Excel 2008 (I have a home / student version that is not configured in advance for Automator), and then click File and click Open.

Any pointers to where to go / look for, how to select menu items like this (or if at all possible)?

You can sort this using the autostart recording function, but the recording is very fragile.

I would rather use AppleScript to just grab the "array" containing each menu item for the application, and then programmatically click on the 0th item in my array ... etc. and etc.

Is it possible?

TIA

+5
source share
4 answers

I don't know about capturing an array, but it looks like it can work for sending mouse clicks, etc:

Virtualinput

0
source
tell application "###"

activate

end tell


tell application "System Events"

tell process "###"

click menu item "^^^" of menu "$$$" of menu bar 1

end tell

end tell

Put your application in ### and place your menu item for ^^^ and place your menu (file, edit, view, etc.) for $$$. Capitalization matters.

Put it in applescript btw

Example:

tell application "iTunes"

activate

end tell


tell application "System Events"

tell process "iTunes"

click menu item "as list" of menu "view" of menu bar 1

end tell

end tell

" "

+3

- . , , ( ), , . .

API AppleScript. AppleScript. , AppleScript " ..." AppleScript Editor.app( , script ). , , , AppleScript.

, ( ) API AppleScript. Excel, , AppleScript, .

, :

+1

, UI- , Apple AppleScript GUI

0
source

All Articles