Kann man mit AppleScript / OSScript auf zusätzliche Menüpunkte klicken?

4412
Jon Lorusso

Ich habe eine Anwendung installiert, die nur in der Menüleiste angezeigt wird (als Menüoption rechts). Ich möchte über das Menü eines der Elemente in seinem Menü klicken. Ich habe den folgenden Code-Ausschnitt gefunden:

osascript -e ' tell application "System Events" tell process "SystemUIServer" tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" is "keymando menu extra") perform action "AXPress" of menu item "Edit Config" of menu 1 end tell end tell end tell 

Leider funktioniert es nicht. Ich nehme an, ich habe den Namen des Menüs extra richtig: "Keymando Menü extra".

0

3 Antworten auf die Frage

1
user495470

SystemUIServer enthält nur Menü-Extras (die Symbole auf der rechten Seite, die neu angeordnet werden können), jedoch keine Statusmenüs (wie die, die Keymando verwendet).

tell application "System Events" to tell process "SystemUIServer" tell (menu bar item 1 of menu bar 1 where description is "clock") click click menu item "Open Date & Time Preferences…" of menu 1 end tell end tell 

In einigen Anwendungen menu bar 2befindet sich das Statusmenü, es wird jedoch tell application "System Events" to UI elements of process "Keymando"eine leere Liste zurückgegeben.

Gibt es überhaupt Zugriff auf diese anderen Statusmänner? Jon Lorusso vor 11 Jahren 0
DANKE DIR! Dies löste gerade meine stundenlange Suche nach dem Weg Andrew Burns vor 10 Jahren 0
1
driven

it may be in there, this will write a list in temp folder, that you can look through for a 'handle'.

`osascript -sso > /private/tmp/StatusBarItems <&- <<EOF tell application "System Events" get properties of every menu bar item of every menu bar of process "SystemUIServer" end tell EOF` 

or you can experiment with

 ` osascript -sso > /private/tmp/SU_reLoad <&- <<BUTTON tell application "System Events" click menu bar item 1 of menu bar 2 of application process "SystemUIServer" end tell BUTTON` 

unfortunately the one I want isn't there... The 'exit full screen button' for a 'none scriptable' app... john

0
w00t

Ich konnte Hangouts mit öffnen

tell application "System Events" to tell process "Google Chrome" to tell menu bar 2 click (first menu bar item where help is "Google Hangouts") end tell