Context menu scripts

When you select a media version in the browser, you can run AppleScripts located in the macOS Script menu’s folder for Musebox.

Create the scripts folder using the macOS Script menu

Show the menu in the menu bar and use it to create the folder.

  1. Open the macOS Script Editor and select the Script Editor > Settings menu item.

    Open Script Editor for me

  2. Enable the “Show Script menu in menu bar” checkbox

    The icon will appear on the right side of the menu bar.

  3. Open Musebox if needed and make it the frontmost application

  4. Open the menu in the menu bar and select Open Scripts Folder > Open Musebox Scripts Folder

    The Musebox scripts folder is created at ~/Library/Scripts/Applications/Musebox and opens in the Finder

Script files you add to this folder will be available in the menu and in a context menu when you Control-click a media version in Musebox.

Supporting both the Script menu and context menu

When the macOS Script menu runs a script, it invokes the script’s run handler, but when Musebox runs a script from a context menu it invokes the performActionWithMediaVersions handler instead (this lets you re-use scripts you’ve made that run after importing library items to work in the context menu as well). If you want a script to work from both the Script menu and the context menu, implement your run handler to get Musebox’s selection and call your performActionWithMediaVersions handler.

A script with both entry points
on performActionWithMediaVersions(theMediaVersions)
tell application "Musebox"
repeat with aMediaVersion in theMediaVersions
set aMediaVersion's rating to 3
end repeat
end tell
end performActionWithMediaVersions
on run
tell application "Musebox" to set aSelection to (get selection of current library)
if length of aSelection is greater than 0 then
tell me to performActionWithMediaVersions(aSelection)
end if
end run