Shortcuts and AppleScript

JPGBoost integrates with macOS's built-in automation tools. A native action is available in Shortcuts and Spotlight, and a compress command is exposed to AppleScript and Automator.

Included in Free

This feature is available on JPGBoost Free as well as Pro. On Free, every image processed counts towards the daily quota: 50 images a day and 5 MB per file. JPGBoost Pro removes both limits.

Two ways to automate

JPGBoost exposes two automation interfaces native to macOS. Both work as standalone processing: they take files and settings as input, return compressed files as output, and are independent of the list currently open in the app's window.

  • App Intents for the Shortcuts app and Spotlight.
  • AppleScript for osascript, Script Editor, and Automator.

The app doesn't need to be open

This is the main difference from the local API and watched folders, both of which require the app to already be running.

Whether it's a Shortcuts action or the AppleScript compress command, macOS relaunches JPGBoost automatically as soon as a request comes in, just like any other scriptable app. You don't have to do anything, even if you had explicitly quit the app beforehand.

What to expect

The only visible effect is a slight delay, the time it takes to launch, when the app wasn't already open. Once processing is done, it stays open: macOS doesn't close it automatically.

The "Compress Images" action

The action appears automatically in the Shortcuts app, under the JPGBoost category, as soon as the app has been launched once. No setup is needed.

  1. Open the Shortcuts app and create a shortcut.
  2. Add an action that supplies files, for example Select Files or Get Folder Contents.
  3. Add JPGBoost's Compress Images action.
  4. Fill in the parameters you want. Any you leave blank can be supplied by an export profile.
  5. Chain another action after it if needed: the action returns the compressed files.
ParameterPurposeRequired
Input FilesThe images to compressYes
Output FormatDesired output formatNo
QualityQuality from 1 to 100No
Export ProfileName of an existing export profileNo
Destination FolderOutput folder (see the warning below)No

The "Destination Folder" field

Known limitation of the Shortcuts app

This is the point that trips people up most often. The Destination Folder field is hard to fill in correctly from the Shortcuts editor. The reliable solution is to go through an export profile.

This field expects a genuine folder reference in URL format, meaning a path starting with file:// (for example file:///Users/me/Downloads/), not plain text. The following methods fail with an Invalid URL error:

  • typing a path by hand, for example /Users/me/Downloads;
  • dragging a folder from the Finder onto the field, which only drops plain text there.

The macOS Shortcuts editor also offers no native "Choose a Folder" action to build one another way. The good news is that a hand-built shortcut is not required at all. It depends on what you want to trigger.

Case 1: no shortcut to build

Once JPGBoost has been launched at least once, the generic phrase it declares itself ("Compress Images with JPGBoost," "Compress with JPGBoost") is directly recognised by Spotlight, without ever opening the Shortcuts app.

This raw invocation only passes along the selected files. No other parameter is provided, which causes the "Missing destination folder" error until the setup below has been done.

For this invocation to work:

  1. In JPGBoost, open Settings → Profiles and set a profile as the default profile, with a destination folder configured.
  2. In the Finder, select the images to compress.
  3. Press ⌘Space, then type "Compress Images."

JPGBoost then automatically fills in the missing parameters from the default profile, including the destination folder, format, and quality.

No shortcut is needed in the Shortcuts app.

Case 2: with a shortcut built

This case is useful when several behaviours need to be available under distinct names. For example, "Compress to Desktop" can use one profile, while "Compress to Archive" uses another. The default profile from case 1 only handles one behaviour at a time.

  1. In JPGBoost, open Settings → Profiles and create a profile with a destination folder, selected with the app's native picker.
  2. In the Shortcuts app, create a new shortcut and give it a clear name, for example "Compress to Desktop."
  3. In the shortcut's JPGBoost action, fill in only Export Profile with the name of the profile to use. Leave Destination Folder blank: the folder set in the profile will be used automatically.
  4. The shortcut is then directly available in Spotlight under the name you gave it, instead of the generic phrase JPGBoost declares.

Spotlight

The action is also accessible from Spotlight. Trigger phrases, such as "Compress images with JPGBoost," are translated into the fifteen supported languages.

Display language

The action's title, description, parameters, and error messages follow the language of the tool displaying them (Shortcuts or Spotlight), independent of the language chosen for the JPGBoost window itself.

AppleScript

The compress command is used just like that of any other scriptable app.

tell application "JPGBoost"
    compress {"/path/to/image1.png", "/path/to/image2.jpg"} ¬
        to "/output/path" format "webp" quality 80
end tell

The to, format, and quality parameters are optional. The profile parameter can replace them, or fill in whatever they don't cover, exactly like --profile on the command line.

tell application "JPGBoost"
    compress {"/path/to/image.png"} profile "Web JPEG"
end tell

The command returns a JSON string: one object per file, with the fields path, originalSizeBytes, compressedSizeBytes, ratio, destination, and error. It's the same shape as the CLI's --json output and the local API's responses.

From the Terminal

osascript -e 'tell application "JPGBoost" to compress {"/path/image.png"} profile "Web JPEG"'

From Automator

Use the Run AppleScript action and paste in the same tell block. This lets you build a service accessible from the Finder's contextual menu.

"Automation" permission

Only one permission to grant

The very first time, macOS shows its usual "Automation" permission alert: the app sending the command (Script Editor, Automator, or Shortcuts) wants to control JPGBoost. Click Allow. This permission is only asked once.

Troubleshooting

SymptomCauseFix
Invalid URL on the destination folderThe field received text instead of a folder referenceUse an export profile with a destination folder and leave the field blank
The action is missing from the Shortcuts appThe app has never been launchedOpen JPGBoost once, then reopen Shortcuts
The action fails with a quota messageThe JPGBoost Free daily quota is reached (50 images), or a file is larger than 5 MBWait for the midnight reset, or move to JPGBoost Pro to lift both limits
The AppleScript command returns an errorAutomation permission deniedCheck System Settings → Privacy & Security → Automation. A Free quota refusal does not stop the batch: it is reported file by file in the JSON returned