Hello all.
I’m trying to write a script that finds the files for the selected tracks in iTunes and copies them to a folder on the Desktop. This is because I buy new music on my laptop but I have no good way to sync this with my iMac at home. This way I could take all track in a playlist “new music” and have the script locate then and copy the files to the folder “To iMac” on the desktop, for easy transfer to the iMac.
This is what I have come up with so far: (It only works for one selected track at a time)
tell application "iTunes"
set selec to tracks of current playlist
repeat with the_track in selec
set track_name to name of the_track
tell application "System Events"
activate application "iTunes"
keystroke "r" using {command down}
end tell
tell application "Finder"
if selection is not {} then
set s to selection
duplicate s to folder "To iMac" with replacing
else
display dialog "Finder encountered an error while trying to copy the track " & track_name & " to ~/Desktop/To iMac." with title "iTunes" with icon 1 buttons {"Cancel"} default button 1
end if
end tell
end repeat
end tell
Hope there’s someone out there that can help me with this.
Thanks in advance,
regards Cesar