2012-11-12 4 views
7

C'è un modo per ottenere un elenco di tutte le voci di menu sotto un titolo di menu come File o Edit con AppleScript?Come posso ottenere un elenco di voci di menu con Applescript?

Ho trovato alcune domande correlate, ma nulla di preciso. Nessuna fortuna su Google neanche.

Sto cercando di ottenere un elenco di quali file sono aperti nel menu Window di Photoshop e individuare quale ha il segno di spunta.

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

penso che potrei essere in grado di fare la seconda parte utilizzando qualcosa come "In Applescript, how can I find out if a menu item is selected/focused?" e l'ispettore Accessibilità in quanto ha AXMenuItemMarkChar

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

risposta

9

non ho Photoshop ma questo funziona per 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 

Per ottenere un attributo TE è possibile utilizzare:

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 scenario:

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

dolce. Grazie! Ora stiamo lavorando su come verificare se è 'nil' :) – cwd

+0

sei un professionista. grazie ancora. – cwd

+0

Felice di aiutare :) – adayzdone

Problemi correlati