Scripting

OffShoot is built with extensibility in mind. Trigger your custom scripts on specific events, and run custom processes, other apps, or integrate OffShoot into an existing workflow.

This feature requires an OffShoot Pro license.

Getting started

The following events are available:

Each event can trigger a script (Python or AppleScript) and has its own set of unique parameters that you can use.

Good to know

  • Timestamps are shown as YYYYMMDDHHMMSS.

  • Duration is in seconds, with six-digit precision.

  • Size is in bytes. To convert bytes to GBs, divide by 1024^3.

  • Script Events are logged in OffShoot's Event Log.

Python

OffShoot can trigger a Python script and pass its event parameters as a JSON string argument.

Requirements

  • macOS

    • OffShoot for Mac 25.2 and newer

    • Python 3, accessible via the python3 command in your system PATH

  • Windows

    • OffShoot for Windows 22.2.6 and newer

    • Python 3 path set in the Registry in PyLauncher key, located at: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PyLauncher

Example Script

Use the Python example below to write OffShoot's event parameters to a file in /tmp

On Windows, when your script does not get fired, check the hedge.log file located in C:\Users\<your-user-name>\AppData\Roaming\Hedge for clues. The most common issue is that a script launcher is not found: ERROR Utilities.Python.PythonHelper - Required PyLauncher for running python scripts was not found in the registry at location 'HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PyLauncher'

Try (Re)installing Python with the official installer, and make sure to enable Use admin privileges.

AppleScript

AppleScript is supported on macOS only.

To be able to use a parameter, you must first declare it at the top of your script:

set theFolder to "{FileCopyCompleted_destinationPath}"

  • return theFolder to output into the Event Log

  • display alert "theFolder = " & theFolder

  • display notification with title "theFolder =" subtitle theFolder

Last updated