iTunes scripting problem

Hi,
I try to make a playlist in iTunes with all my tracks whose kind is not the ACC-format. (like MPEG, MOV, etc). I’ve recently made such script. This one actually makes a playlist with all tracks whose bit rate is greater then 193.
So for making my new script, I just typed over the whole thing, and adjusted the variables, etc. However, while my first script runs OK, my seconds script just won’t work. I get an error like this:

this is the script that works (the bit rate script):

set myString to day of (current date) & " " & ¬
	month of (current date) & " " & ¬
	year of (current date) & " (" & ¬
	hours of (current date) & "-" & ¬
	minutes of (current date) & "-" & ¬
	seconds of (current date) & ")"

tell application "iTunes"
	set myToHighBitRateTracks to every track whose bit rate > 193
	
	set myPlaylist to make new playlist with properties {name:"To High Bitrate " & myString}
	
	repeat with i in myToHighBitRateTracks
		duplicate i to myPlaylist
	end repeat
	
	if (count every item of myPlaylist) is 0 then
		delete myPlaylist
		display dialog "Geen songs met te hoge Bit Rate."
	end if
end tell

and this is the script that won’t work (the kind script):

set myString to day of (current date) & " " & ¬
	month of (current date) & " " & ¬
	year of (current date) & " (" & ¬
	hours of (current date) & "-" & ¬
	minutes of (current date) & "-" & ¬
	seconds of (current date) & ")"

tell application "iTunes"
	set NonACC to (every track whose kind does not contain "AAC")
	
	set myPlaylist to (make new playlist with properties {name:"Non-ACC " & myString})
	
	repeat with i in NonACC
		duplicate i to myPlaylist
	end repeat
	
	if (count every item of myPlaylist) is 0 then
		delete myPlaylist
		display dialog "Geen songs die niet in het AAC-formaat staan"
	end if
end tell

I really don’t see where the bug is, because I just typed it all over. I hope you can see it.

Thanks in advance,
ief2

PS.: I’m sorry for my English. I know I sometimes make some rubbish sentences, but I ask you to forgive me. I’m only 14 years old and I come from Belgium, so I speak dutch. If you don’t understand me, don’t hesitate to give a reply on that.

Model: iMac
Browser: Safari 531.9
Operating System: Mac OS X (10.6)

Hi,

wouldn’t it be easier to create a smart playlist for each condition?

I always delete the playlist after I used the script. But actually, yes it would be easier, but still .:stuck_out_tongue:

by the way: the result of your method to create a date string is a list, not a string.
This does the same


set myString to do shell script "date +%d' '%B' '%Y' ('%H-%M-%S')'"

Maybe this causes the problem

Nope, it’s not my problem :frowning:

Hello. It’s probable that you have one or more missing files. Unlike a potential empty list produced and ignored in the bitrate code, a missing location value will halt your script. Alter your repeat loop to test:


repeat with i in NonACC
		try
			duplicate i to myPlaylist
		on error
			if i's location as string is "missing value" then display dialog i's name as string --missing file
		end try
	end repeat

I replaced my part of the script with yours and it is working :smiley:

thanks!!!

but I’m not learning from this one:/ is their a way to explane me what I might have done wrong?