Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

simX

macrumors 6502a
Original poster
May 28, 2002
766
4
Bay Area, CA
Anyone know a reliable way of setting the artwork for a song in iTunes through AppleScript? Here's how I GET the artwork through iTunes:

Code:
tell application "iTunes"
	set the_artwork to data of artwork 1 of current track
end tell


But when I try to do the analogous setting of the artwork through AppleScript like this:

Code:
tell application "iTunes"
	set the_artwork to read POSIX file "/UNIX/PATH/TO/FILE" as picture
	set data of artwork 1 of current track to the_artwork
end tell

... all that happens is iTunes crashes and I get a "connection not valid" error or a "parameter error" (last night I got the connection error, but today I ran the same script and got a parameter error -- I swear I didn't change anything). Can anyone tell me how to modify my script so that it works? Any help at all would be greatly appreciated.

(Just in case it matters, I'm using iTunes 4.8 on Mac OS X 10.4 Tiger.)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.