I wanted to have Firefox launch and also have the “About Firefox” dialog box appear. For some reason, I was getting the error: Open Firefox (the name of my script) is not allowed assistive access. (-1719). So I created an Automator app and put the Applescript inside an action. See attached.
on run {input, parameters}
tell application “Finder”
activate
–open application file “Firefox” of folder “Applications” of startup disk
–delay 20
–activate
tell application “Firefox” to activate – GUI Scripting statements
tell application “System Events”
delay 1
tell process “Firefox”
delay 1
click menu item “About Firefox” of menu 1 of menu bar item “Firefox” of menu bar 1
end tell
end tell
end tell
--(* Your script goes here *)
return input
end run
Please put your code inside ``` lines. Doing so will make your code easy to read and to work with.
Like so…
```
tell application “Firefox” to activate
tell application “System Events”
delay 1
– etc…
```
As to your code… remember that using ui scripting is like using the mouse and keyboard. When working with menus, you must first click to open the menu and then click to select an item – it is a two-step process.
tell application "Firefox"
activate
tell application "System Events"
tell application process "firefox"
perform action "AXPress" of menu bar item "Firefox" of menu bar 1 -- open firefox menu
perform action "AXPress" of menu item "About Firefox" of menu "Firefox" of menu bar item "Firefox" of menu bar 1 -- open 'about firefox'
end tell
end tell
end tell