Hi,
I have a Folder Action Script attached to a number of folders which detects the name of the folder (different manual lens names and focal lengths) and appends this information to the EXIF metadata of images dropped into the folders. Up to and including Monterey, it worked fine.
I haven’t used the script for some time and have since updated to Ventura.
Now when I run the script, I get an error.
The broken part of the script, without any of the metadata stuff, is:
on adding folder items to this_folder after receiving added_items
try
tell application "Finder" to set holding_folder to (name of folder this_folder)
on error the_error
display dialog the_error
end adding folder items to
And the error, when I drag an item into the attached folder, is:
I’ve tried various forms of coercion (POSIX path of this_folder, this_folder as alias…) to no avail.
Is there away of turning «data alis626…» into useable information?
Thanks for any insights!
this_folder is AppleScript alias reference (not to be confused with Finder alias-file). In the past, with recent updates, there have already been cases where, in some cases, System Events stopped working correctly with AppleScript aliases.
Apparently, with the Ventura update, the Finder application can no longer extract the name directly from the AppleScript alias (so to speak, it also became less “smart”).
In any case, the way prescribed in the dictionary is to extract the name from the Finder-reference to the folder - folder (HFS-path). Those. the following should work:
.
tell application "Finder" to set holding_folder to name of folder (this_Folder as text)
NOTE: (this_Folder as text), the AppleScript alias coerced as text became HFS path
Thanks @KniazidisR
Unfortunately with your script I’m still getting a variation on the same error:
I was pretty certain that alis is an AppleScript alias reference, but thanks again for confirming.
I’ve trimmed the script to avoid getting the Finder involved but still the error persists.
This script:
on adding folder items to (this_folder) after receiving added_items
try
set holding_folder to (this_folder as text)
on error the_error
display dialog the_error
end try
end adding folder items to
Gives this error:
I ran the script on Ventura without problems.
The only issue (wrong syntax) is the keyword folder
in front of this_folder
because it’s already a (alias) reference. You don’t even need the parentheses.
tell application "Finder" to set holding_folder to name of this_folder
You can also use System Events
instead of Finder
Thanks @StefanK
I think our posts must have crossed. As you can see from my previous post, even without involving Finder, I’m getting an error when trying to resolve the alias data.
With this script:
on adding folder items to (this_folder) after receiving added_items
try
tell application "System Events" to set holding_folder to name of this_folder
on error the_error
display dialog the_error
end try
end adding folder items to
I get this error:
This is only an issue for me with Folder Action Scripts. The following script:
set this_folder to (choose folder)
tell application "System Events" to set holding_folder to name of this_folder
Works as expected.
Thanks again to both @KniazidisR and @StefanK for your input and suggestions. The issue appears to have been resolved in the most recent Ventura beta. Case closed.