'items of folder' finds file but 'info of' doesn't

This is so odd it must be a syntax/format problem. I have the following within a ‘tell’ finder block:


set file_list to items of folder pdf_folder
	repeat with t_item in file_list
		display dialog t_item as string
		set file_info to info for t_item
		display dialog the name of the file_info
	end repeat

The display shows the correct path but the ‘info for’ statment fails saying the file cannot be found. Although the file exists Applescript can’t have it both ways. Either the file can be found by both ‘items of folder’ and ‘info for’ or neither. Can anyone spot my error? TIA.

Does it work if you use this?

set file_info to info for alias (t_item as text)

– Rob

Thanks, yes it does. All I can say is, now you are on the hook to explain that peice of black magic.

When you tell the Finder to ‘set file_list to items of folder pdf_folder’, it generates Finder references such as:

file “picnic001.jpg” of folder “Images” of folder “Documents” of startup disk

Not much other than Finder understands this type of reference. The fix converts the Finder reference to a regular path, such as:

“Mac HD:Documents:Images:picnic001.jpg”

– Rob

Thanks for the explaination. I can only shake my head wondering at the reasoning behind that but then I guess that is a “Finder” issue not an Applescript obscurity. Applescript has to deal with whatever it is given.