Hi,
I’ve written a script that process a folder full of Excel files. I’ve saved it as an application so that it can process a folder dropped on it.
I wanted to add some error trapping to make sure that only a folder is dropped on it, and not a file.
open (myfolder)
tell application "Finder"
set theKind to name of myfolder
if kind of myfolder is "file" then
display dialog "This script can only work if a folder containing files is dropped on it"
set continueFlag to False
end if
end tell
end open
I’ve excluded all the rest of the script for brevity sake.
I will obviously add a whole lot more error trapping later on to exclude non excel files, etc. But I’m stumped at this point.
When I drop a file on the app, I get an error:
Can’t get kind of {alias “The:Path:to:the:file.xls”}.
It’s clear that my script is picking up an alias, rather than the actual file, but how do I get around that? I seem to remember a script posted here that mentioned file vs alias issues, but I can’t find it any more.
Thanks for any help.
Han Solo