Scripting Retrobatch

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 folder "/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.

AppleScript Node

TODO