Search code examples
scriptingsyntaxnumbersapplescriptitunes

Applescript: expected end of line but found number


I'm trying to automatically select a menu item in iTunes using applescript. However, every time that I run this script I get an error message that says "expected end of line but found number, and points me to "scrollarea 1". I'm using Apple's UIElement inspector to get the names of the GUI elements in iTunes. Any help would be greatly appreciated.

Here's what I have so far:

tell application "iTunes"
      activate
      delay 10
      tell application "System Events"
            key code 53
            tell outline 1 of scrollarea 1 of window 1
                 click menu 1
            end tell
      end tell
end tell

Well, I have it clicking what I need it to be clicking. The only problem now is that it's not actually clicking it, it's just returning the AXValue. I need it to actually click the item in iTunes itself.


Solution

  • activate application "iTunes"
    tell application "System Events"
        tell process "iTunes"
            select row 15 of outline 1 of scroll area 2 of window "iTunes"
        end tell
    end tell