Introduction to Scripts in Hedge | Hedge for Mac Knowledge Base

Introduction to Scripts in Hedge

We’ve built Hedge with extensibility in mind: run your custom AppleScripts from within Hedge, and the sky is the limit.

Not sure what scripts can do for you? Read more about it in our blog over on Medium.

Look before you leap
AppleScript support is a pro feature. Easy to learn, but even easier to screw up. Always test your script with disposable data, and then test again. And again.

If you’re new to scripting, find someone to help you out, or use the scripts available here. You’re still solely responsible, even for the use of (example) scripts that are available on this site.

Events and Parameters
Hedge works with Events. When an event occurs, Hedge outputs several parameters for that Event. You can keep an eye on this output using the Script Log (⌘-L in Hedge).

To use a parameter declare it first, at the top of your script:

  • property theFolder : "{FileCopyCompleted_destinationPath}"

Want to check if you declared a parameter correctly? Return the value:

  • return theFolder, outputs into the Script Log
  • display alert "theFolder = " & theFolder
  • display notification with title "theFolder =" subtitle theFolder

Good Practices

1. Exclude these drives from your scripts: Boot OS X, Recovery HD
2. Close the Script Editor when you want to run a script in Hedge.
3. Use only one return per Script

Enabling Scripts

When you download a script from this site or other sources, unpack the zip. Then open Hedge, go to Preferences and select the event you want to add a script to. Click the Browse... button and find your script. From now on, this script will launch every time this event occurs.

Add Script