Search code examples
applescriptitunes

GUI scripting iTunes to list playlist tracks by "status"


Been fiddling around with GUI and using the element inspector, but can't seem to be able to get AppleScript to click the little button on the top left of iTunes playlists which sorts tracks in the order they were added to the playlist (it's blank, but inspector says it's an AXButton called "status").

Any ideas?

If there is a non-GUI way of doing this, happy to hear it!

Thanks

Tardy


Solution

  • This works on iTunes 12.4.1.6 (tested on El Capitan):

    tell application "System Events"
        tell process "iTunes"
            tell splitter group 1 of window "iTunes"
                if exists splitter group 1 then
                    tell button "status" of group 1 of outline 1 of scroll area 1 of splitter group 1 to perform action "AXPress"
                else
                    tell button "status" of group 1 of outline 1 of scroll area 1 to perform action "AXPress"
                end if
            end tell
        end tell
    end tell