Reference problem

When I call a handler from outside another handler it runs fine doing what it is supposed to do. When I call the same handler from within other handlers, it doesn’t work, except if within the handler I’m calling from I place a display dialog in it. Any ideas? (Note: type_list and extension_list are globals.)

convert_files(image_files) -- This  works

on test(temp_folder)
	tell application "Finder"
		--display dialog ("whatever") --uncomment this and it works
		set image_files to every file of the temp_folder whose file type is in the type_list or name extension is in the extension_list
	end tell
	convert_files(image_files)
	return true
end test

--Convert files in file list
on convert_files(image_files)
	repeat with i from 1 to the count of image_files
		set this_file to (item i of image_files) as alias
		set the res to my resize_convert_save(this_file)
	end repeat
	return true
end convert_files

Hi,

Pre-Panther OS X there is a bug that the filter reference form doen’t work with the ‘contain by’ operator. This line:

set image_files to every file of the temp_folder whose file type is in the type_list or name extension is in the extension_list

I’m thinking that you might have use two different methods for setting the value of image_files. Maybe you should post two scripts. one that works and one that doesn’t.

EDITED: Also, you may be having problems with the references. In the handler, you’re getting Finder references. Then you send those references to the other handler. You can try to get a list of alias instead by using ‘as alias list’.

You’re right, when I created the list of files in a different way it worked. Thanks.