Scripting and Automation

An Overview of Scripting

With scripting, it's possible to control Audio Hijack programmatically. Scripts can be connected to respond to certain events or executed via the Shortcuts.app (MacOS 12 and up). While this functionality is primarily targeted at those who can write their own JavaScript, the built-in scripts make basic automation possible for anyone.

On this page, we cover the basics of using scripting and automation in Audio Hijack. If you're ready to write your own scripts, head over to the scripting center in our Knowledge Base.

Session Automations

Scripts can be triggered by events that happen within a session. To do this, you'll configure what we call automations. Automations are created in the Scripting tab of your session. When a specific Event occurs, it will cause the automation to Run the selected script.


Automations in a session's Scripting tab

Users who are proficient in JavaScript will be able to create scripts that are then triggered with automations, but you don't need any coding ability to take advantage using the built-in scripts. See below for several examples.

Example Automations

Have a look at these simple examples that automate common tasks. You can recreate and adjust them yourself, right in the Scripting tab of any session.

Add a Recording to Music

With the automation shown above, Audio Hijack will add your recordings to Apple's “Music” app automatically.

Reveal a Recording in the Finder

This automation will automatically open the folder where your recording was saved in the Finder.

Quit Audio Hijack When a Timer Finishes

Scripts trigged by an automation also receive context-aware information (such as file or session objects) that script authors can utilize. See the API reference for complete details.

Script Library Window

The creation and management of Audio Hijack scripts is handled in the Script Library window, accessible from the Window menu.


Audio Hijack's Script Library window

This window shows two types of scripts, Built-In Scripts and User Scripts. The Built-In Scripts are bundled with Audio Hijack, and can't be edited. However, you can copy those scripts over to User Scripts with the Duplicate button. User Scripts can be created, edited, and removed at your discretion.

Shortcuts.app Actions

On MacOS 12 (Monterey) and up, Audio Hijack also provides actions for use with the system's Shortcuts app, making it possible to hook Audio Hijack into larger external workflows.

  • Run/Stop Session: Turn an Audio Hijack session on or off.

  • Run a Script: Execute an existing script from the Script Library window on a specified session.

  • Run JavaScript: Execute an arbitrary JavaScript snippet in Audio Hijack. You can also optionally collect the results for further processing.

Note that the latter two Shortcuts will require you to enable the Allow execution of external scripts setting in the Settings window.

Resources for Scripters

If you're familiar with creating scripts, you'll be able to extend Audio Hijack's functionality by writing your own scripts. Audio Hijack's scripting is accomplished via the execution of JavaScript code. The Audio Hijack scripting API allows control of various aspects of sessions, blocks and recordings, and the app provides an integrated editor to create and manage your scripts.

To get started, visit the scripting center in our Knowledge Base.

More to Come

For the initial implementation of scripting in Audio Hijack, we sought to create a solid base upon which we can build in future updates. If there's more you'd like to see, get in touch let us know more.

Purchasing Audio HijackTranscribe Block