dougscripts.com

October 31 2014 - 3:06 pm

Save Current Track's Artwork

I don't know why you'd want to do this on any kind of regular basis, but I thought it was kinda fun for a Friday afternoon. I wanted to see if I could save artwork from iTunes Radio tracks, but it works with whatever the current track is:

tell application "iTunes"

try

if player state is not stopped then

set alb to (get album of current track)

tell artwork 1 of current track

if format is JPEG picture then

set imgFormat to ".jpg"

else

set imgFormat to ".png"

end if

end tell

set rawData to (get raw data of artwork 1 of current track)

else

return

end if

on error

display dialog "Problem getting track info." buttons {"OK"}

return

end try

end tell

try

set baseLoc to choose folder

on error

return

end try

set newPath to ((baseLoc as text) & alb & imgFormat) as text

try

tell me to set fileRef to (open for access newPath with write permission)

write rawData to fileRef starting at 0

tell me to close access fileRef

on error m number n

log n

log m

try

tell me to close access fileRef

end try

end try

Open that in Script Editor and "Save..." it as "Save Current Track's Artwork" (or whatever) in your ~/Library/iTunes/Scripts/ folder. Whenever a track is playing, you can launch it to choose a folder in which to save the current track's artwork. Great way to fill up your desktop with effluvia. (I'm kidding. But it would be good for that.)

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.