2012-11-12 25 views
7

क्या ऐप्पलस्क्रिप्ट के साथ File या Edit जैसे मेनू शीर्षक के अंतर्गत सभी मेनू आइटमों की सूची प्राप्त करने का कोई तरीका है?मैं एप्पलस्क्रिप्ट के साथ मेनू आइटम की सूची कैसे प्राप्त कर सकता हूं?

मुझे कुछ संबंधित प्रश्न मिल गए हैं, लेकिन कुछ भी सटीक नहीं है। Google पर कोई भाग्य नहीं है।

मैं फ़ोटोशॉप के Window मेनू में कौन सी फाइलें खुली हैं, इसकी एक सूची प्राप्त करने का प्रयास कर रहा हूं, और यह पता लगाएं कि किसके पास चेक मार्क है।

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

मुझे लगता है कि मैं "In Applescript, how can I find out if a menu item is selected/focused?" की तरह कुछ का उपयोग करके दूसरे भाग ऐसा करने में सक्षम हो सकता है और पहुंच-इंस्पेक्टर सकता है के बाद से यह AXMenuItemMarkChar

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

उत्तर

9

मैं फ़ोटोशॉप की जरूरत नहीं है नहीं है लेकिन यह इलस्ट्रेटर के लिए काम करता है:

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 

एक attribu प्राप्त करने के लिए ते आप का उपयोग कर सकते हैं:

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 

शून्य परिदृश्य:

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

मीठा। धन्यवाद! अब यह जांचने के लिए कि यह 'nil' है या नहीं 0 :) – cwd

+0

आप एक समर्थक हैं। फिर से धन्यवाद। – cwd

+0

मदद करने के लिए खुश :) – adayzdone