0
votes

I am using an apple script to copy files from a ram disk to a connected server. I can make the disk and connect the server automatically but I am having trouble to get the files to copy to the server automatically.

I am using a main app the creates the disk and connects to the server. I also have a folder actions script that will move folders/files placed in the ram disk and move them onto the server. However, I have to manually add the FA script via Folder Actions Setup in order for the ram disk to move files to the server because, obviously ram disks and all of their data will be erased upon a restart. So I need a way to set the folder action of a new folder on a new disk.

I have tried to use the following command at the end of the main app but it either doesn't work or it errors out. tell application "System Events" to attach action to folder "Filemaker" of disk "ramdisk" using "/Library/Scripts/Folder Action Scripts/FMBackups.scpt"

Even if you're not sure on whether something will work, any useful suggestions would be greatly appreciated!

1

1 Answers

0
votes

Your syntax was OK in old versions (at least up to 10.6.8). Since it has been depreciated and it must be replaced by "make" :

tell application "System Events"
make new folder action at end of folder actions with properties {enabled:true, name:"FolderName", path:"path:to:my:folder}
tell folder action "FolderName" to make new script at end of scripts with properties {name:"myScriptName.scpt"}
end tell