Easily copy your selected tracks from iTunes to a new folder without subfolders for artists etc.
Did you ever have an album with different artists and tried to copy the music to your mp3 player (not iPod)? Then you know what this script is for, simply select the tracks you want to copy in iTunes and run this script it will ask you for a folder to copy the track files to, you hit ok and the script will do the rest.
AppleScript copy selected iTunes tracks to a new folder
global selected_track_files, track_titles, files_destination
tell application "iTunes"
if selection is not {} then
set sel to selection
set selected_track_files to {}
set track_titles to {}
set files_destination to choose folder with prompt "Where do you want to copy your selected tracks to?"
with timeout of 30000 seconds
repeat with current_track in sel
set end of track_titles to (name of current_track)
set end of selected_track_files to (get location of current_track)
end repeat
end timeout
if selected_track_files is not {} then
my copyItunesFiles()
else
display dialog "Sorry, couldn't get your selected tracks."
end if
else
display dialog "Select the tracks you want to copy to a new location."
end if
end tell
to copyItunesFiles()
set trackTitleList to ""
tell application "Finder"
repeat with i from 1 to the count of the selected_track_files
set currentFile to item i of selected_track_files
set currentTitle to item i of track_titles
set trackTitleList to trackTitleList & ", " & currentTitle
duplicate currentFile to folder files_destination
end repeat
if trackTitleList is not "" then
display dialog "Successfully copied the following tracks: " & trackTitleList
else
display dialog "Sorry, couldn't copy your tracks."
end if
end tell
end copyItunesFiles