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
- Open iRightMenu Pro → Menu Editor
- Right-click in the middle panel → Add → Script
- 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
- 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.
Symlink to Desktop
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 filesset 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/fooinstead offoo) - 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.