

However, when I tried this myself, Automator seemed unable to save the variable properly. (You may also be able to accomplish this without third party actions by using an Applescript block-something like tell application "Finder" to return container of (input as alias). At the time that I bought it (a few months ago), the developer charged $20. The action you want is "Get Parent Folders of Finder Items" in the "File and Folder Automator Action Pack". However, if you are running macOS 10.13 or earlier, you can purchase a package of third-party Automator Actions from. This action is not built in to Automator. So, the parent folder of a file in ~/Downloads/MyDownloadedFile.pdf will be the Downloads folder, and you could save that to a variable. A common misconception is that an action performed by a Power. This is a really important concept to understand when working with files in Power Automate and Logic Apps. I don't think you can get the folder an action is attached to, but I think a good analog would be to get the parent folder of the current file. Like all other Power Automate connectors, the Encodian connector for Microsoft Power Automate (Flowr) and Azure Logic Apps receives and sends files as Base64 encoded strings. Using this return theContainingFolder as text as the last line of the AppleScript code, the “Containing Folder”, stores the variable as an HFS Path… which is the same as the path as an alias but without the word “alias”(As shown in the image below) Using this return theContainingFolder as the last line of the AppleScript code, the “Containing Folder”, stores the variable as a Posix Path.

Set theContainingFolder to container of (item 1 of input) as alias
#Get file path automator string code#
Here is the AppleScript code for the Automator workflow. Move Processed Files Back To The Original Folder Action Attached Folder Continue Processing Files Before Moving Them Back To Original Folder Set movedFiles to move theNewItems to theMoveToFolder Set theContainingFolder to container of item 1 of theNewItems as alias theNewItems is a list of references to the items added to the folder theFolder is a reference to the modified folder Called after items have been added to a folder On adding folder items to theFolder after receiving theNewItems Property theMoveToFolder : path to documents folder - Define Your Own Temporary Move To Folder
#Get file path automator string full#
This following AppleScript Folder Action code will store the full path of the folder the Folder Action is attached to, in the variable theContainingFolder property theContainingFolder : missing value scpt file into the following folder “/Users/YOUR SHORT NAME/Library/Workflows/Applications/Folder Actions/“, your new Folder Action will be available systemwide and you will then be able to attach your new folder action to any folder using the Folder Actions Setup.app. Personally, I find that creating Folder Actions directly in Script Editor.app, gives me much more flexibility.
