Determine if a file alias has been dropped onto by droplet.

How can I determine whether a file dropped onto my droplet is a file alias.

Finder has the “alias file” handler, but how can I create a finder file from my applescript file to make the test?

Agnar

Hi,

as far as I know the open handler resolves the alias file so the reference ponts to the original file

Actually, I believe the alias is resolved before anything gets near the open handler.

. which is the behaviour that Mac OS users (as opposed to scripters!) expect with a droplet.

Yep. The same thing happens with other apps – they get passed the files the aliases point to, never the aliases. I gather resolving aliases is a suprisingly tricky affair.

A pity, because I want to use the droplet to synchronize the folder which the alias points to with the folder where the alias is.

I’m not sure what you are trying to do with the actual alias files, but does it have to be a droplet? Or could you drop the folder that contains the aliases?

Even though dropping a file resolves the alias, it looks like you can access the info of the alias at least when you directly specify the file - could you loop through the files in the folder to get at the aliases themselves?

info for file "Path:to:your:alias"

Edit:

These also work with the alias, instead of the original


tell application "Finder"
	set foo to "Macintosh HD:Users:USERNAME:Desktop:my folder:myFile.pdf" -- this is the alias, not the original
	set bar to (container of file foo) -- gets the parent folder of the alias, not the original
	delete foo -- deletes the alias, not the original
end tell

So I’d say if you can reference the alias files in another way than directly dropping the alias files themselves, you might be able to do what you are wanting.