Need help with a confusing script error

I’ve got a script I’m using for iTunes. When I run it directly from the script editor it works perfectly. However, when I run it from iTunes’ scripts dropdown menu, it always produces an error (“Parameter Error”). I am confused.

can we see the code ?

mm

Here’s the code. It’s a modification of “convert & export” from Doug’s Applescripts site. I’ve made a few more changes since and I no longer get the parameter error but it stops part way through the script (at the “try” section). If I save as a run-only app it does work from iTunes’ dropdown menu. Thanks for any help on this!

tell application "iTunes"
	activate
	if kind of container of view of front browser window is not library or selection of front browser window is {} then
		display dialog "You must select some tracks first." buttons {"Cancel"} default button 1 with icon 2 giving up after 15
	end if
	
	
	set sel to selection of front browser window
	-- plural for dialog
	set s to "s"
	if (count of items in sel) is 1 then set s to ""
	
	set myEncoders to name of every encoder
	set encoderBackup to name of current encoder
	
	set myNewEncoder to (choose from list myEncoders with prompt ¬
		"Convert track" & s & " using..." default items (encoderBackup as list) ¬
		OK button name "OK" cancel button name ¬
		"Cancel" without multiple selections allowed and empty selection allowed) as string
	if myNewEncoder is "false" then error number -128
	
	set uD to (choose folder with prompt "Move converted file" & s & " to...")
	if uD is false then error number -128
	
	set current encoder to encoder myNewEncoder
	
	set cnt to 0
	repeat with this_track in sel
		try -- skip on failure
			set new_track to item 1 of (convert this_track)
			set loc to new_track's location
			set dbid to new_track's database ID
			set name_hold to "0" & (cnt + 1) & "-" & (get name of new_track)
			set name of new_track to name_hold
			-- change ID3 tags
			set artist of new_track to ""
			set album of new_track to ""
			set genre of new_track to ""
			set rating of new_track to 0
			set grouping of new_track to ""
			set composer of new_track to ""
			set comment of new_track to ""
			set track number of new_track to 0
			set track count of new_track to 0
			set disc number of new_track to 0
			set disc count of new_track to 0
			
			-- move the file to new location
			do shell script "mv " & (quoted form of POSIX path of loc) & " " & (quoted form of POSIX path of uD as string)
			
			-- delete the track
			delete new_track
			set cnt to cnt + 1
		end try
		
	end repeat
	
	set current encoder to encoder encoderBackup
end tell