artwork scripts cause 'OUT OF MEMEORY' error????

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

hangon

New member
Joined
Aug 22, 2003
Messages
8
Points
0
Please choose the appropriate forum for this topic. Thank you. Please choose the appropriate forum for this topic. Thank you. Please choose the appropriate forum for this topic. Thank you. Please choose the appropriate forum for this topic. Thank you. Please choose the appropriate forum for this topic. Thank you. Please choose the appropriate forum for this topic. Thank you. I, i'm making a little script to export iTunes Artwork....it works pretty well but for 15 to 20 artwork exported it crashes...due to a 'OUT of MEMORY' error...

there is a lot of tiny piece of script grabbed in different scripts from other authors...but i can't see what is causing this error

here is the code (a part of it)
Code:
set target_folder to (choose folder with prompt "Where do you want to save your Images?") as string

tell application "iTunes"
	set old_fi to fixed indexing
	set fixed indexing to true
	set sel to get a reference to selection
	with timeout of 30000 seconds
		repeat with aTrack in sel
			
			set artworkData to (data of artwork 1 of aTrack)
			set imageFormat to (format of artwork 1 of aTrack) as string
			if imageFormat contains "JPEG" then
				set extension to ".jpg"
			else if imageFormat contains "PNG" then
				set extension to ".png"
			end if
			set FileName to album of aTrack & extension
			
			set filepath to target_folder
			set tempFile to filepath & "temp" & extension
			set finalFile to filepath & FileName
			set the tempFile to the tempFile as text
			
			set the tempFile to open for access file tempFile with write permission
			write artworkData to the tempFile starting at 0
			close access the tempFile
			
			do shell script "cd " & quoted form of (POSIX path of filepath) & ";?
			tail -c+223 " & quoted form of ("temp" & extension) & "> " &?
			quoted form of FileName & ";rm " & quoted form of ("temp" & extension)
			do shell script "rm " & quoted form of (POSIX path of finalIconedImage)
			
		end repeat -- all selected tracks
	end timeout
	copy old_fi to fixed indexing -- restore fixed indexing
end tell


i imagine that the error is caused by the graphical objects to stay in memory...but i don't know how to purge the memory with applescript or how to pass a reference to the image data that will allow to avoid to load these data in memory.


HELPPPP
 
Top