Error -54 File permission error

I have been using applescript to manage a couple of parameters in my iTunes library, mostly the key which is represented by the Camelot scale(mixed in key) in the comments and tempo. I have found the easiest way to do this with WAV files(it is iTunes after all) is through a variety of applescripts and one that runs them all. About a week or two ago it started returning with “error “iTunes got an error: File permission error.” number -54”

Script examples: key 2B

tell application “iTunes”
set sel to every track of playlist “2B”
set comments to “2B”
set sel to a reference to every track of playlist “2B”
set appendum to “2B”
repeat with this_track in sel
set this_track’s comment to “2B”
end repeat
end tell

Script examples: Tempo 106

tell application “iTunes”
set sel to every track of playlist “106”
set comments to “106”
set sel to a reference to every track of playlist “106”
set appendum to “106”
repeat with this_track in sel
set this_track’s bpm to “106”
end repeat
end tell

I was also wondering if there is a simple way to migrate all those playlists to a playlist folder? It would not be difficult to move the playlists I’m just wondering what I would have to do with the applescript. That is obviously much less important but would be helpful if it isn’t to much work.

By the way, OS 10.6.7
iTunes 10.3.1

Thanks

The explanation for error number -54 is: “permissions error (on file open)”. Maybe that gives you more of a clue. Its not an itunes error, it’s an error from the Carbon framework and can be found in the file “MacErrors.h”.

A comment about your example code. It could be written better like this. The other lines don’t do anything…

tell application "iTunes"
	set sel to a reference to every track of playlist "2B"
	repeat with this_track in sel
		set this_track's comment to "2B"
	end repeat
end tell

Thanks much! It was the first time I spent any real time on an applescript project so the code is pretty questionable.