Skip to content

Sample AppleScripts

Uploading images with Transmit and AppleScript

This example was first created on our forums, and the purpose is to upload images at the end of a workflow using the file transfer app Transmit from Panic.

You can copy and paste the script below into an AppleScript node in Retrobatch. Make sure it comes after your write node, and make sure to change the Transmit favorite name "myFavorite" to whatever server favorite you have setup in Transmit.

global transmitBrowser

using terms from application "Retrobatch"
    (*
    The processStart handler is called when your workflow has started running
    *)
    on processStart()
        tell application "Transmit"
            set myFave to item 1 of (favorites whose name is "myFavorite")

            tell current tab of (make new document at end)
                connect to myFave

                set transmitBrowser to remote browser

            end tell
        end tell
    end processStart

    (* 
    The processAsset handler is called for each image asset that passes through this AppleScript node
    You can return a boolean value that says wether or not this asset should continue on through the next node(s)
    *)
    on processAsset(anAsset)

        set assetPath to file path of anAsset

        tell application "Transmit"
            tell transmitBrowser
                upload item at path assetPath
            end tell
        end tell

        return true

    end processAsset

end using terms from