Permission Error with iTunes 8.0.2

I’ve been using a much longer version of this script to import files into itunes 7 for over a year. It worked great until I upgraded to itunes 8.0.2 and now I’m suddely getting a permission error. The problem is so simple, it’s frustrating. There seems to be some fundamental change in how iTunes 8 is interacting with the track properties.

tell application "iTunes"
	activate
	set myAif to the last track of playlist "Library"
	set artist of myAif to "Whatever"
	set album of myAif to "Whatever"
end tell

Here’s the event log:
tell application “iTunes”
activate
get last track of playlist “Library”
file track id 20998 of library playlist id 20995 of source id 41
set artist of file track id 20998 of library playlist id 20995 of source id 41 to “Whatever”
“iTunes got an error: File permission error.”

Of course any help would be appreciated.
-bloving

Works fine for me; I also have iTunes 8.0.2 under OS X 10.5.5. I did change one thing, but it should not matter:

tell application "iTunes"
	activate
	set myAif to the last track of first library playlist
	set artist of myAif to "Whatever"
	set album of myAif to "Whatever"
end tell

Thanks for the reply.

The only discrepancy I see is that I’m running 10.4.11 as opposed to 10.5, but that seems an unlikely culprit.
I tried reinstalling iTunes, as well as repairing permissions on the drive.
I’m able to change the properties on the track manually so I don’t think it’s an actual permission issue. iTunes seems to be working well otherwise.

I’m stumped.

I agree. I will be near a 10.4.11 machine later tonight, and will play around with it.

I am using a dual G4 Power Mac running 10.4.11 and iTunes 8.0.2, and the script still works just fine. I also tried this:

set myAif to track -1 of first library playlist

which worked just fine.

The only other thing I can think of is to go to your iTunes preferences, under Advanced, and make sure that the box is checked for Copying files to iTunes Music Folder. Maybe if there is a track not in the library, that would make a permissions issue?? I really don’t have any other potential answer for that.

I had pretty much given up on this just being a strange little anomaly on my computer, but I just tried it on a different computer and got the exact same error. That computer is also running iTunes 8.

I feel like the problem is probably related to how I am referencing the file. Perhaps

set myAif to the last track of playlist "Library"

isn’t referencing the correct file. (BTW, I tried the other variations of that with the same results.) In iTunes 7 it would grab the file the I just imported, but perhaps that’s not the case in iTunes 8. I’m not sure how to cross check that.

The code works fine here:

A) PowerBook G4 with Mac OS X 10.5.5 & iTunes 8.0.2
B) iMac Intel Core Duo with Mac OS X 10.5.5 & iTunes 8.0.2

BUT I would not suggest to reference the library playlist with «playlist “Library”». This immediately throws an exception on my Mac running a German system, because there the library playlist is given the localized name “Musik”. Therefor I would suggest to use «playlist 1».

Which kind is your last track?
If it’s a shared track for example, you have no permission to change anything

Thanks for the input guys. I made a tiny bit of progress.
I’m using this script to manipulate track properties for aif files that I import into iTunes.

I inserted

set fileName to name of myAif as text
	display dialog fileName

into the middle of the script to make sure that my

set myAif to the last track of playlist "Library"

was referencing the aif file that I just imported into iTunes. It was not. It was referencing a random podcast. I (still) don’t why that is the case.
When I isolated the recently imported Aif File into a new playlist and pointed the script specifically towards that playlist, I was able to manipulate the properties of the track.