I have a workflow that basically copies data from a specifically named USB (proof of concept at the moment) to a local folder. I would like to distribute this to other users since Automator seems to be per user. What is the optimal and safest way to distribute this where the user has to do as little as possible?

I have attempted to simply copy the workflow into the Folder Actions directory for another user, but that doesn't enable to folder actions automatically, so when plugging in the USB device, the workflow never runs. I also found a script within another post but that created folders on the Desktop and applied those actions there. I am trying to apply folder actions to /Volumes when a USB is mounted.

enter image description here

Script as of 5/25 @ 12:38 PM EST:

property TriggerFolder : "Volumes"
property attachFolderActionTo : (path to startup disk as text) & TriggerFolder

set resourceName to "USB Copy.workflow"
set PathToWorkflows to (path to workflows folder)
set PathToFolderActions to (PathToWorkflows as text) & "Applications:Folder Actions:"
set FolderActionScript to ((path to me as string) & "Contents:Resources:" & resourceName) as string

tell application "Finder"
    if exists folder PathToFolderActions then
        error number -128
            set newfo to make new folder at PathToWorkflows with properties {name:"Applications"}
        end try
        delay 1.0
            make new folder at newfo with properties {name:"Folder Actions"}
        end try
    end if
end tell

tell application "Finder"
    duplicate file FolderActionScript to folder PathToFolderActions with replacing
end tell

tell application "Folder Actions Setup"
        set addFolderAction to make new folder action with properties {name:TriggerFolder, path:attachFolderActionTo}
    end try
        delay 0.5
        tell addFolderAction to make new script with properties {name:resourceName, path:(PathToFolderActions & resourceName)}
    end try
    if not folder actions enabled then
        set folder actions enabled to true
    end if
end tell
  • Original link I was working from:apple.stackexchange.com/questions/343258/…
    – madknacker
    Commented May 23, 2022 at 16:00
  • What have you tried so far? From the script in that linked topic, the way to add the folder action is pretty much the same, just the names and paths would need to be changed.
    – red_menace
    Commented May 23, 2022 at 16:22
  • I tried just copying and pasting my workflow into the location for another user. That doesn't actually do anything when I plugged in the test USB. I also tried modifying that script to include /Volumes but I wasn't quite sure how to use that path since that is the path. I kept getting /Volumes and Volumes folders on my desktop along with a popup to enable folder actions on Volumes. I have also added a photo of my workflow that I would like to distribute to others and get working as simply as possible.
    – madknacker
    Commented May 23, 2022 at 16:31
  • If you want the workflow to be triggered by Folder Actions, then Folder Actions needs to be configured. Just copying it to the FA folder doesn't set up an action. I don't know if it's possible to automate that.
    – benwiggy
    Commented May 23, 2022 at 16:34
  • @benwiggy I guess the automation of the folder actions configuration is what I am looking for. Not sure if it's better to do this workflow as a full fledged Python script or something similar.
    – madknacker
    Commented May 23, 2022 at 16:35


You must log in to answer this question.

Browse other questions tagged .