Repository navigation
app • macOS Automator
Generic setup shared by my Finder Quick Actions (watermarkImg, addDateImg, renameForServer): each one is a Python script called by an Automator Quick Action, plus a small native SwiftUI app (built locally) that only shows its window and posts the end-of-task notification.
Automator runs the exact interpreter written in the Quick Action (/opt/homebrew/bin/python3), so install the libraries for that one. A plain pip3 may target a different Python.
/opt/homebrew/bin/python3 -m pip install -U Pillow pillow-heif
/opt/homebrew/bin/python3 -c "import sys, PIL; from PIL import features; print(sys.version.split()[0], PIL.__version__, 'AVIF:', features.check('avif'))"-
pillow-heifusually ships its ownlibheif. If the install tries to build from source and fails:brew install libheif, then the pip command again. - Image tools from Homebrew used by the scripts:
brew install librsvg(providesrsvg-convert, for SVG),brew install exiftool(to inspect metadata).
xcode-select -p # prints a path when installed
swiftc --version
xcode-select --install # if missingEach script folder has a build_app.sh that compiles its <Name>App/main.swift into <Name>.app and signs it ad hoc (enough for a locally built app, macOS doesn't block it). Run it again after any change to the Swift source or after a macOS update if the app misbehaves. The .app is git-ignored.
⚠ « usbgT7 » is my personal external USB drive. Skip this if the scripts are on the main drive.
The scripts live in /Volumes/usbgT7/aiScripts/. Automator needs an absolute path and doesn't load my .zshrc aliases (e.g. cdscript, which only works in an interactive Terminal), so one symbolic link covers every script folder:
ln -s /Volumes/usbgT7/aiScripts ~/aiScriptsIf the drive is unplugged, the link stays but is broken until the drive is back.
- Open Automator → File › New →
Quick Action. - At the top of the document:
-
Workflow receives current →
image files(orfiles or foldersto accept any file type) -
in →
Finder - Image (optional) → an icon from the list, or Choose… for your own (square PNG)
-
Workflow receives current →
- Drag the Run Shell Script action to the right, then set Shell →
/bin/zshand Pass input →as arguments. - Script box:
/opt/homebrew/bin/python3 "$HOME/aiScripts/<folder>/<script>.py" "$@" - File › Save with a clear name: that name is the one shown in the Finder's right-click menu.
Quick Actions are saved in ~/Library/Services/. To edit one: in Automator, Open an Existing Document…, press Cmd+Shift+G, type ~/Library/Services, pick the .workflow file. Renaming the .workflow file in the Finder renames the menu item.
-
Automation › Finder: some dialogs are shown by the Finder (
tell application (path to frontmost application)) so they get the focus. If macOS asks whether Automator / WorkflowServiceRunner may control the Finder, click Allow. Review in System Settings › Privacy & Security › Automation. - Notifications: each app asks once whether it may send notifications: click Allow. In System Settings › Notifications › <app name>, keep Desktop checked and Alert Style on Temporary (banners that slide away).
- A Focus mode is on (Do Not Disturb, Sleep, Personal, Reduce Interruptions…): notifications still arrive, but only in Notification Centre. Check the Focus tile in Control Centre. A Focus turned on on the iPhone also applies to the Mac when Settings › Focus › Share Across Devices is on. To let the scripts through anyway: add their apps in the Focus' Allowed Notifications › Apps.
- The screen is shared or mirrored (screen recording, video call, AirPlay mirroring): enable System Settings › Notifications › Allow notifications when mirroring or sharing the display.
- AppleScript's
display notificationis attributed to Script Editor (clicking it opens Script Editor), which is why the scripts post notifications from their own app instead.
-
No dialog appears at all → check that Pass input is
as arguments, not "to stdin". -
Finder alert "The action "Run Shell Script" encountered an error" → unexpected error: run the same command in the Terminal, with a real file path instead of
"$@", to see the details. - The Quick Action doesn't appear in the menu → enable it in System Settings › Keyboard › Keyboard Shortcuts › Services, then relaunch the Finder (Option+right-click on its Dock icon → Relaunch).
-
Clicks get lost in a script's file chooser (seen since macOS 27.2) → a dialog opened by a background
osascriptlaunched from the Finder may not get the focus. Have the frontmost app show it, or use a native app launched withopen -W.
Set-up Automator for custom Quick Actions