I'm trying to set a boolean value to myVariable using the "Folder" property, but the Applescript editor keeps interpreting it as a class.
Here is a shorted code. this is part of a bigger code to identify files dropped into a folder and create a new folder which it renames based on the date of the file that is dropped into the folder. Unfortunately, it keeps making folders every time it makes a new folder. Resalting in continuous loop of folders being created and renamed to "2025".
The plan is to us an IF condition to prevent the creation of folders when a folder/s are dropped into my folder with my Folder Action.
property directory : "Catalina:Users:Username:Desktop:Folder:File.pdf
tell application "Finder"
set pathname to POSIX path of directory
set item_info to the info for directory
set myVariable to Folder of item_info
return myVariable
end tell
I noticed the following when I compile the script
- The color of the "Folder" is blue. I believe this means it's a class. Normally when I call a property, the color turns pink. it does it correctly when I use "set the file_name to the "name" of this_file". I also tried declaring the "Folder" property in brackets "Folder". did not help
I noticed the following when I run the script:
- It returns ---error number -10004 "A privilege violation occurred. When it runs the "info for" command.
I gave the Script Editor Full File access, Full Accessibility access and the FolderActionsDispatcher has full Finder access.
Can anyone point me in the right direction!
- What is the cause of the privilege violation or how would I find what the cause is?
- How do I force the Script Editor to get the "Folder" property of a folder?