Script Menus

iRightMenu Pro’s “script menu” lets you write a snippet of code as a right-click menu—select files, right-click, click the menu, and the script runs with the selected files’ absolute paths automatically passed in.

Want full technical detail (argument handling, environment variables, file match rules, admin-privileged scripts, osascript syntax, etc.)? See Script Development Guide.


Create a Script Menu in 5 Minutes

  1. Open iRightMenu Pro → Menu Editor
  2. Right-click in the middle panel → Add → Script
  3. In the right Inspector, fill in:
    • Title: text shown in the menu
    • Script content: the code to run
    • Feedback type: pick “Result dialog” first—it pops up the script output for easy debugging
  4. Save. Back in Finder, select any file, right-click, click your menu

Hello World

Set “Script content” to one line:

echo "Hello, $1"

$1 is the full path of the selected file. After running, you should see Hello, /Users/...—success.

Multi-File Loop (Most Common Template)

for f in "$@"; do
    echo "Processing: $f"
done

"$@" is all selected files. You must wrap the variable in double quotes—otherwise paths with spaces get split apart (macOS user directories have many spaces, e.g. Application Support).


5 Common Recipes

Copy these into a menu, adjust title / match rules, done.

Open with VSCode

/usr/local/bin/code "$@"

If VSCode is installed elsewhere, adjust the path. Or with the code CLI installed, just code "$@".

Show Total Size of Selected Items

du -ch "$@" | tail -1

Set “Feedback type” to “Result dialog” to see the totals.

for f in "$@"; do
    ln -s "$f" "$HOME/Desktop/$(basename "$f")"
done

Copy MD5 to Clipboard

md5 "$@" | pbcopy
osascript -e "display notification \"Copied $# MD5(s)\" with title \"iRightMenu\""

Move to Trash (Recoverable)

Requires the trash CLI: brew install trash

trash "$@"

Safer than rm—items can be restored from Trash.


Troubleshooting

Right-click Doesn’t Show the Menu

Most common—match rules misconfigured. Check the “Match rules” group in the Inspector:

  • File match type: None = all files match; Extension = only files in the list
  • Count limits: Min files / Max files set wrong also hides the menu
  • Show on files / folders: toggle wrong, the menu won’t appear

Command Not Found

The script’s PATH does NOT load your ~/.zshrc, so your usual aliases / custom paths aren’t there by default. Two fixes:

  • Use the full path (e.g. /usr/local/bin/foo instead of foo)
  • Fill in “Custom PATH” in the Inspector to add your directory

Path with Spaces Breaks

Variables must be in double quotes—write "$f" not $f. macOS user directories have many spaces (Application Support, Group Containers).

Can’t See Script Output

Switch “Feedback type” to “Result dialog”—each run will pop up the output.

See Full Execution Log

Each script has its own log file: iRightMenu Pro → Preferences → Advanced → “Open log folder”, then Scripts/<menu-title>.log is the full record (each run’s exit code, output, args, env vars).


Want to Do More

  • Write in AppleScript / JavaScript / Python (argument handling differs)
  • Run scripts with admin privileges
  • Match menus only to specific extensions / regex files
  • Access clipboard / control other apps / custom env vars from scripts

Full coverage, all options, debug techniques in the Script Development Guide.

If you want to “package the script as a distributable product”—with UI forms, uploadable to the plugin store—you should write a Lua plugin.

Developer Documentation
User Guide
Getting Started Script Menus FAQ
Script Development
Development Guide
Plugin Development
Quick Start Development Guide Example Plugins
API Reference
Overview API Query Plugin Info Logging Finder Context Plugin Settings Internationalization
UI & Interaction
Dialog Progress Notification Chooser WebView Status Bar Dock
Files & Paths
File Operations Path Utilities Finder Actions Trash Extended Attributes Metadata File Watcher
Data Formats
JSON Plist CSV XML PDF Image
Text & Encoding
String Regex Date & Time Color Crypto
System
Shell Commands Process Application System Info AppleScript Shortcuts
System Info
Network Power/Battery Screen/Appearance Audio Bluetooth Location
Network
HTTP WebSocket URL
Input & Clipboard
Keyboard Mouse Hotkey Clipboard Window
Storage
SQLite Keychain UserDefaults
Media
OCR QR Code
Utilities
Archive UTI Share Timer Wake Lock Thread