0

I am new to appplescript and programming in general. would someone be so kind as to look over my code. I know its not in proper applescript syntax yet, as I struggled to find that information.

tell application iTunes
for each track in library playlist{ #all listed tracks, regardless of what files i have.  may include dead links
set tr to track name
if file location is missing then search for it at external/Music/iTunes else messagebox(tr no file)
if search has result cut and paste to Music/itunes
check if file now exists else messagebox(tr error)
} end tell
connor
  • 11
  • 1
  • 2

1 Answers1

0

I'll get you started. Here's how you can find the song name and artist of all tracks not found on your computer. You'll have to build on this to do the rest of your stuff.

set missingTracks to {}
tell application "iTunes"
    set alltracks to tracks of library playlist 1
    repeat with aTrack in alltracks
        set theLocation to location of aTrack
        set doesExist to my fileExists(theLocation)

        if not doesExist then
            set thisInfo to {songName:name of aTrack, songArtist:artist of aTrack}
            set end of missingTracks to thisInfo
        end if
    end repeat
end tell
return missingTracks


on fileExists(theLocation)
    tell application "Finder"
        if exists theLocation then
            return true
        else
            return false
        end if
    end tell
end fileExists
regulus6633
  • 18,848
  • 5
  • 41
  • 49
  • Thank you very much. any recommendations on where best to learn this? – connor Jan 15 '15 at 19:11
  • When I started I did the tutorials called "Applescript tutorials for beginners" found here: http://macscripter.net/viewtopic.php?id=25631. Good luck. – regulus6633 Jan 15 '15 at 20:37