Inserting additional artwork into iTunes tracks

Hello applescript experts/enthusiasts-
I am trying to insert additional album artwork into a given track in iTunes. I have been successful at getting one piece of artwork into a track (see http://bbs.applescript.net/viewtopic.php?t=10586&highlight=artwork). However, when I do the following ,


set pathToImage to ":path:to:image"
tell application "iTunes"
	set currentArtwork to (read file pathToImage from 513 as artwork)
	set artwork 2 of current track to currentArtwork
end tell

I get a ‘parameter error’. If there is already artwork in position 2, it works fine. Therefore, I think that the solution must have something to do with creating new artwork and inserting it into the iTunes track. However, I have not yet figured out how to do this.

Does anyone have any thoughts or comments on how to accomplish this?

Thanks in advance…
-Ryan

Does it really work for you just setting the artwork as opposed to setting the data of the artwork? This works for me (assuming the file is a pict):

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

yeah, sorry. You are absolutely correct.
‘set data’ must be there.

My question is still the same however. I get a ‘parameter error’ if trying to insert for artwork > 1.

My script was tested on Mac OS X 10.3.9 and iTunes 4.7.1 (30). iTunes had some trouble with “current track” unless the current track was actually playing. Not sure why that is. Anyway, the code I posted above worked for adding new artwork to a track regardless of what was already there (0, 1, or more artworks). Are you using a PICT file or some other file as the artwork? This only worked for me when using PICTs (and, indeed, the code you reference for reading from byte 513 on is meant to strip the header from PICT files, not other types of image files).

Jon

weird. It works great with no artwork (so it is putting some into artwork 1). After that, I get the ‘paramter error’. I have the same specs…

Can anyone else get this to work?

I don’t know what to tell you. Running this script:

Results in this on my machine:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

I’ve noticed that the read from 513 doesn’t work with iTunes 4.8 in Tiger. I’ll get a transparent background, which renders as black in the artwork pane. Anyone have any suggestions?

Anyone solved that issue in Tiger?