This is really weird. I have a folder action script that has been running for a long time (as in days/weeks) without being changed and it has run many times successfully. All of a sudden today it is throwing an error. And while I’ve narrowed down what is throwing an error it’s very strange that it has been running fine until now. I have not updated the OS or done anything else that would explain the issue.
I can reproduce the error in a sample script as follows:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set f to choose file
tell application "Finder" to reveal the container of f
When I run that in Script Debugger I get the following error:
Finder got an error: Can’t get alias “Macintosh HD:[PATH_TO_F]”.
My folder action script performs an action on a file that is located by reference to the location of the file that is passed to the folder action handler. That is, I get the container of the container of the file that is passed to the handler, convert it to text, append the other file name, and convert it to an alias.
It is throwing the following error: Error Can’t make «class ctnr» of alias “Macintosh HD:[PATH_TO_FOLDER]” into type text.
It definitely seems like an error related to the class ctnr which I assume is Finder’s container item class.
The above sample script which tells Finder to reveal the container works fine if you just tell it to reveal the file. But if you tell it to reveal the container then it throws an error, but the error says that it can’t find the file (and doesn’t reference the container).
And all of this is extra strange because until yesterday this was working perfectly.
Can anyone else reproduce the issue from the above sample code or offer any other insight?
macOS 10.14.6