Problem with iTunes artwork

I apologize if this is old news: I’m trying to fire up a script I wrote years ago, that worked fine years ago, but which now crashes. Here it is in it’s simplest form:


tell application "iTunes"
	set thisTrack to current track
	set thisArt to artwork 1 of thisTrack
	set thisPic to data of thisArt as picture
end tell

It appears to now be broken, at least in iTunes 12. It’s the third line that kills. I get a “Can’t make <<data … [very long string of data] …>> to picture [SIC]”. The only posts I’ve been able to find so far are from around 2010 when this was working, and they use this syntax. I even copy/pasted from a tutorial thinking maybe I was losing my mind, but hit the same error.

What is the proper Applescript for capturing an image file from iTunes artwork now?

Thanks!

Model: MBP early '11
AppleScript: 2.7
Browser: Safari 600.3.18
Operating System: Mac OS X (10.8)

Hi,

before reinventing the wheel take a look at Doug’s AppleScripts for iTunes

Thanks for the reply, Stefan.

The only scripts I could find at Doug’s on this subject, were run only that I cannot seem to open. Perhaps you have a solution to this?

I have tried to find an answer there and elsewhere.

Try this:

tell application "iTunes"
	set thisTrack to current track
	set thisArt to artwork 1 of thisTrack
	set thisPic to data of thisArt
end tell
set thePath to (path to desktop as text) & "Test.jpg"
set fileRef to open for access file thePath with write permission
write thisPic to fileRef
close access fileRef

Hey Shane!

Sorry it took a while to find your reply, but I want to thank you for the reply!