Q: Applescript to copy/export mp3 by album
Dear all,
I would like with applescript copy all selected album from iTunes to a USB key (to be used in my car) but I would like the mp3 are copied in specific folders (according the album name included in the tags of mp3). I have slightly modified a script found on the net (see below) but all mp3's are copied in the same folder and I dont know how to read the alcum tag and create a specific folder to copy all mp3 related to the same album. As you can see, I am new with applescript... Any idea to help me. Thanks a lot. Frankie666
+++++++++++++++++
if application "iTunes" is not running then
display alert "iTunes is not running" message "Please activate iTunes and select items."
return
end if
-- Choose destination location
choose folder with prompt "Choose a folder to copy the selected iTunes items into:" default location (path to desktop)
set DestinationFolder to the result
set {TrackLocations} to {{}}
-- Get filepaths of the selected iTunes items
tell application "iTunes" to repeat with SomeTrack in (get the selection)
try -- skip items that are not file tracks (no location)
set the end of TrackLocations to location of SomeTrack
end try
end repeat
-- Copy all selected MP3s
repeat with SomeFile in TrackLocations
tell application "Finder"
duplicate SomeFile to DestinationFolder
end tell
end repeat
tell application "Finder" to reveal DestinationFolder
iTunes, OS X Mavericks (10.9)
Posted on Feb 12, 2014 4:38 AM
In applescript they're called "handlers". Vive le différence!
With respect to the other question, see the user tip I just created. If only you knew how often I've had to explain that POSIX path thing. The 'set output' lines catch the path (in your final version the HFS path) of the folder (be it newly created or found in the file system), so that the path can be returned in the last line.
Posted on Feb 15, 2014 9:40 AM