Skip to content

AppleScript

Scripting nodes are available in Retrobatch Pro.

The AppleScript node is not availabe in the App Store version of Retrobatch.

Due to restrictions applications must abide by, the AppleScript node is not avaiable for use when Retrobatch is purchase from the App Store. If you want to use the AppleScript node, you'll need to purchase Retrobatch directly from us.

Run an AppleScript file as part of a workflow. The node references a script file and also works by calling 3 different handlers- on processStart(), on processAsset(anAsset), and on processEnd(). The processAsset handler can also return a Boolean value, which lets the AppleScript node know whether or not to continue processing the asset. The AppleScript code can act as a filter by calling various properties on the passed in asset. Open up Retrobatch's scripting dictionary in either Script Debugger (the preferred way) or Script Editor to see the list of properties on assets.

Calling Retrobatch With AppleScript

Use AppleScript to call Retrobatch from another app, Script Editor, Folder Actions, and more. Here's the simplest example for running a Retrobatch workflow:

tell application "Retrobatch"
    set d to open ((POSIX file "/path/to/file.retrobatch") as alias)
    tell d
        execute
    end tell
end tell

You can also add two additional options to the execute command, which tell Retrobatch where to read images from, as well as where to write out the images. This is handy if you want to make a template of a workflow, and reuse it for multiple image inputs and outputs.

tell application "Retrobatch"
    set d to open ((POSIX file "/path/to/file.retrobatch") as alias)
    tell d
        execute input items "/path/to/folder/of/images/10" output folder "/path/to/output"
    end tell
end tell

Watch Folders With Folder Actions

(Note: This is an advanced topic, and familiarity with AppleScript is required)

It's also possible to use MacOS's built in Folder Actions to watch a folder for new images and then have those images processed through a Retrobatch workflow. To start, copy and paste the following AppleScript into Script Editor (in your Applications/Utilities folder) or with another app such as Script Debugger. Save that to your ~/Library/Scripts/Folder Action Scripts/ folder (and make it if it doesn't already exist). Replace the "/path/to/file.retrobatch" entry with the path to your own Retrobatch workflow.

on adding folder items to theAttachedFolder after receiving theNewItems

    tell application "Retrobatch"
        set d to open "/path/to/file.retrobatch"
        tell d
            execute input items theNewItems
        end tell
    end tell

    tell application "Finder"
        -- Uncomment the following line to move the items to the trash.
        -- move theNewItems to the trash
    end tell

end adding folder items to

Next, locate your folder to watch in the Finder, select it, and choose the Finder ▸ Services ▸ Folder Actions Setup… menu item. The Folder Actions Setup application will launch, and ask you to pick a script. If you saved your script from above in the "Folder Action Scripts" folder, it will appear as a selection in the sheet that comes up.

Now, when you add one or more images to your folder, Folder Actions will see that, run your script, which will then let Retrobatch know to process the files.