Hi -
I’m getting an error from a script, but only when run from certain directories.
I’ve reduced the script down to the following.
set scriptFile to path to me
tell application "Finder" to set scriptFolder to (container of scriptFile) as alias
In one directory I get
It the other, I get
Same exact file, copied from one to the other. I’ve checked directory ownership, the permissions are the same. There’s no obvious special characters in the paths.
I’ve tried it in several directories. It seems consistent as to which directories it works in, and doesn’t work in.
Any ideas? I’m stumped.
And, just for background: The goal is to iterate through a list of files in the current directory, and open them in powerpoint. That’s working. At least, it works in some directories. But I’m open to other ways of doing this.
Thanks!
I have no idea, only questions.
path to me should return an alias. What do you see in the event log when you get the error? It looks like this when no error:
tell current application
path to current application
--> alias "Macintosh HD:Users:lucid:code:solr201:BuildPresentation.applescript"
end tell
What do you get in the event log with the as alias commented out?
set scriptFile to path to me
tell application "Finder" to set scriptFolder to (container of scriptFile) --as alias
What’s the consistency? Does it always fail on the same folder(s)? What is their common denominator - any attribute that makes them different, as a group?
Anything at all, really, which sets them apart from other folders, maybe even something about the state of the system when they were created. Try renaming, or deleting existing folders and making new ones with the same names.