Help with old script from Jaguar to Panther

Hello,

I have this script that worked under os 10 Jaguar, now that i have moved to Panther is not working anymore, can someone plz help.



tell application "Finder"
	set FOLDERwithITEMS to alias ((startup disk as string) & ":Users:testuser:Documents")
	
	if (count of FOLDERwithITEMS) < 1 then
		
		empty
		
	else
		
		set locked of (files of entire contents of FOLDERwithITEMS) to false
		update (files of entire contents of FOLDERwithITEMS)
		delete entire contents of FOLDERwithITEMS
		empty
		
	end if
	
end tell

Were you getting this error message: “Finder got an error: Expected a reference.” You should mention error messages that you get.

I think it’s just a question of coercing the alias to a Finder object, (the ‘count’ command doesn’t seem to like aliases):


tell application "Finder"
	
	set FOLDERwithITEMS to alias ((startup disk as string) & ":Users:testuser:Documents")

	set FOLDERwithITEMS to item FOLDERwithITEMS --> Finder object
	
	if (count of FOLDERwithITEMS) < 1 then
		empty
	else
		set locked of (files of entire contents of FOLDERwithITEMS) to false
		update (files of entire contents of FOLDERwithITEMS)
		delete entire contents of FOLDERwithITEMS
		empty
	end if
end tell