Can't get <<class utid>> of "file"

THis happens wen i drag and drop a file…


on open {dropped_item}
	set the inputfile to the dropped_item as string
	if get_audio_usable(inputfile) then
		skype_set_audio_input(inputfile)
	else
		error_out("--011", "Bad or Un-supported file type.")
	end if
end open

the one method i belive to be the problem


on get_audio_usable(file_path)
	tell application "System Events" to set type_identifier to (get the type identifier of file_path)
	tell application "System Events" to set type_extension to (get the name extension of file_path)
	
	set type_identifier to type_identifier as string
	set type_extension to type_extension as string
	set type_keywords to {"audio", "mp3", "aac", "aif", "aiff", "aifc
", "wav", "m4a", "au", "midi", "mid", "mp4", "wma"}
	
	repeat with keyword in type_keywords
		set keyword to keyword as string
		if keyword is equal to type_identifier then
			set bob to 1
			exit repeat
		else if keyword is equal to type_extension then
			set bob to 1
			exit repeat
		else
			set bob to 0
		end if
	end repeat
	
	if bob is equal to 1 then
		return true
	else
		return false
	end if
	
end get_audio_usable

Any ideas?

Hi,

the problem is the alias as string coercion at the beginning of the script.
by the way: the dropped_items parameter of the open handler is always a list, so it’s preferable to specify the item explicitly.
the get_audio_usable() handler can be written much easier, the parameter inputfile is an alias


property type_keywords : {"audio", "mp3", "aac", "aif", "aiff", "aifc", "wav", "m4a", "au", "midi", "mid", "mp4", "wma"}

on open dropped_items
	set the inputfile to item 1 of dropped_items
	if get_audio_usable(inputfile) then
		skype_set_audio_input(inputfile)
	else
		error_out("--011", "Bad or Un-supported file type.")
	end if
end open


on get_audio_usable(file_path)
	tell application "System Events" to set {type identifier:type_identifier, name extension:type_extension} to file_path
	return type_identifier is in type_keywords or type_extension is in type_keywords
end get_audio_usable

Stefan,

Thank you…

ALSO wow a lot easier…

Thanks,
KevinR