iamsudo wrote:
I cannot get any reference for the context menu and its child elements.
Nor do I. However, with at least one track selected in the iTunes window, it is not too difficult, using GUI Scripting in conjunction with cliclick, to open the contextual menu and select a menu item. For example:
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes"
tell window "iTunes"
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1
tell (row 1 whose selected is true)
set {x, y} to position
end tell
end tell
end tell
end tell
end tell
do shell script "/usr/local/bin/cliclick kd:ctrl c:" & (x + 5) & "," & (y + 5) & " ku:ctrl"
tell application "System Events" to keystroke "Get Album Artwork" & return
Tested under OS X 10.8.3 with iTunes 11.0.2 and cliclick 2.2. (When using GUI Scripting, you must enable access for assistive devices in the Accessibility System Preference pane.)