Friday, October 22, 2021

#1 2021-09-21 03:59:37 am

robmauzy
Member
Registered: 2021-09-20
Posts: 1

Attaching a folder script

I ca not for the life of me figure out why this script is not working. Can anyone help me out?

tell application "System Events"
    set folder actions enabled to true
    make new folder action at end of folder actions with properties {enabled:true, name:"Downloads", path:"/Users/rmauzy/Downloads"}
    tell folder action "Downloads" to make new script at scripts with properties {name:"/Library/Scripts/Folder Action Scripts/add - open in MerrillToolX.scpt"}
end tell


Thank you

Browser: Safari 605.1.15
Operating System: macOS 10.14


Filed under: folder action

Offline

 

#2 2021-09-22 08:08:02 am

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2091

Re: Attaching a folder script

You have syntax of make new script wrong. Clause at scripts should be at end of scripts. And, you should provide script's Posix path instead of the name. Here is full example:

Applescript:


set targetFolder to choose folder with prompt "Choose folder you want make Hot folder"
set targetFolderPath to POSIX path of targetFolder

set folderActionScript to ¬
   choose file of type "com.apple.applescript.script" default location ¬
       (((path to library folder from user domain) as text) & ¬
           "Scripts:") as alias
set folderActionScriptPath to POSIX path of folderActionScript

tell application "System Events"
   set folder actions enabled to true
   set folderName to name of targetFolder
   if not (exists folder action folderName) then set folderAction to make new folder action at ¬
       end of every folder action with properties {name:folderName, path:targetFolderPath}
   make new script at end of scripts of folderAction ¬
       with properties {POSIX path:folderActionScriptPath}
end tell

Last edited by KniazidisR (2021-09-22 08:10:54 am)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)