2012-11-12 16 views
7

Gibt es eine Möglichkeit, eine Liste aller Menüelemente unter einer Menüüberschrift wie File oder Edit mit AppleScript zu erhalten?Wie kann ich eine Liste von Menüpunkten mit Applescript erhalten?

Ich habe einige verwandte Fragen gefunden, aber nichts genaues. Kein Glück bei Google.

Ich versuche, eine Liste der Dateien zu öffnen, die in Photoshop Window Menü geöffnet sind, und herauszufinden, welche das Häkchen hat.

screenshot-with-shadow.png http://img33.imageshack.us/img33/4526/screenshotwithshadow.png

Ich glaube, ich könnte den zweiten Teil zu tun, indem sie mit so etwas wie „In Applescript, how can I find out if a menu item is selected/focused?“ und der Zugänglichkeit Inspektor der Lage sein, da es AXMenuItemMarkChar

screenshot-with-shadow.png http://img99.imageshack.us/img99/4526/screenshotwithshadow.png

Antwort

9

Ich habe nicht Photoshop hat aber das funktioniert für Illustrator:

activate application "Adobe Illustrator" 
tell application "System Events" 
    tell process "Adobe Illustrator CS5.1" 
     set xxx to name of every menu item of menu 1 of menu bar item "Window" of menu bar 1 
    end tell 
end tell 

Um ein Attribut zu erhalten te können Sie:

activate application "Adobe Illustrator" 
tell application "System Events" 
    tell process "Adobe Illustrator CS5.1" 
     set xxx to value of attribute "AXMenuItemMarkChar" of menu item "tools" of menu 1 of menu bar item "Window" of menu bar 1 
    end tell 
end tell 

nil Szenario:

activate application "Adobe Illustrator" 
tell application "System Events" 
    tell process "Adobe Illustrator CS5.1" 
     set xxx to value of attribute "AXMenuItemMarkChar" of menu item "Brushes" of menu 1 of menu bar item "Window" of menu bar 1 
     try 
      xxx 
     on error 
      -- insert your code 
      beep 2 
     end try 
    end tell 
end tell 
+0

Süße. Vielen Dank! Jetzt arbeiten, um zu überprüfen, ob es "Null" ist :) – cwd

+0

Sie sind ein Profi. Danke nochmal. – cwd

+0

Gerne helfen :) – adayzdone

Verwandte Themen