Hello,
I am attempting to create an applescript that controls a third party menu item extra. (Those little menu items on the right side of the menu bar) I have been unable to access these menus. I have had no trouble accessing the Apple menu items or menu item extras with other scripts. But for some reason I have been unsuccessful when it comes to controlling third party extras (such as the Air Video extra). So, are these icons located on "menu bar 1", are they actually referred to as "menu items?" Here is an example of what I have come up with so far: (This is a modification of StefanK's ad hoc script on MacScripter)
Here is there error i receive:
error "System Events got an error: Cant get menu item \"Stop Server\" of menu 1 of menu bar item 7 of menu bar 1 of process \"SystemUIServer\"." number -1728 from menu item "Stop Server" of menu 1 of menu bar item 7 of menu bar 1 of process "SystemUIServer"
I understand this to mean that it can't find the menu item "Stop Server." But this is because it never looked in the Air Video Menu Extra menu.
Any advice on how to access this third party menu extra?
Thank you,
UAKJ
I am attempting to create an applescript that controls a third party menu item extra. (Those little menu items on the right side of the menu bar) I have been unable to access these menus. I have had no trouble accessing the Apple menu items or menu item extras with other scripts. But for some reason I have been unsuccessful when it comes to controlling third party extras (such as the Air Video extra). So, are these icons located on "menu bar 1", are they actually referred to as "menu items?" Here is an example of what I have come up with so far: (This is a modification of StefanK's ad hoc script on MacScripter)
Code:
property MenuAction : "Stop Server"
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with the_menu from 1 to the count of menu_extras
if item the_menu of menu_extras is "Air Video Menu Extra" then exit repeat
end repeat
tell menu bar item the_menu
perform action "AXPress"
delay 0.2
perform action "AXPress" of menu item MenuAction of menu 1
end tell
end tell
end tell
end tell
Here is there error i receive:
error "System Events got an error: Cant get menu item \"Stop Server\" of menu 1 of menu bar item 7 of menu bar 1 of process \"SystemUIServer\"." number -1728 from menu item "Stop Server" of menu 1 of menu bar item 7 of menu bar 1 of process "SystemUIServer"
I understand this to mean that it can't find the menu item "Stop Server." But this is because it never looked in the Air Video Menu Extra menu.
Any advice on how to access this third party menu extra?
Thank you,
UAKJ