0

I fear I already know the answer to this one, but is there any way to access the locally-stored Mobile Applications in an iTunes library using AppleScript?

The selection property appears to not function with apps:

tell application "iTunes" to get selection

With, say, a podcast, I get a result like:

{file track id 656 of user playlist id 541 of source id 74 of application "iTunes"}

But with an app selected, I just get:

{}

Alternatively, is there a 'rawer' way to access the mobile applications? Merely enumerating them in the file system won't suffice, because I'm trying to change their file location in the iTunes library.

1

If you want raw. You could try:

activate application "iTunes"

tell application "System Events"
    tell process "iTunes"
        keystroke "i" using command down -- open the info window
        set theName to title of window 1 -- get the name
        keystroke "." using command down  --close the info window
    end tell
end tell
log theName

This will get the name of the selected app

I have 170 apps so if I selected the first one and then run

set the logList to {}
activate application "iTunes"
repeat 170 times
    tell application "System Events"
        tell process "iTunes"
            keystroke "i" using command down -- open the info window
            set theName to title of window 1 -- get the name
            keystroke "." using command down --close the  info window
        end tell
        copy theName to end of logList

        --DO OTHER SOME STUFF

        key code 124
    end tell

end repeat

count of logList

I can walk through them via the script and get each name. I did not seem to need a delay in it .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .