Tutorial: trigger Perform and Timer actions using Terminal and AppleScript

First of all, Thanks to @SteveC for helping me with command line in Terminal.

I will use ‘Z Perform Action 1’ as the Incoming Perform name and ‘Z Timer’ as the Incoming Timer name for the examples of this post.

For sending parameters to the Incoming Perform action, you must add values or variables separated by commas after the name. As example, “Z Perform Action 1,8,gm” will trigger ‘Z Perform Action 1’ with 2 parameters (8 and the value of the variable gm).

  1. TERMINAL

You can trigger Perform actions pasting one of the following lines into Terminal:

open -n -a "Bome MIDI Translator Pro" --args -triggerPerform "Z Perform Action 1"
"/Applications/Bome MIDI Translator Pro.app/Contents/MacOS/MIDITranslatorPro" -triggerPerform "Z Perform Action 1"

And trigger Timers with:

open -n -a "Bome MIDI Translator Pro" --args -triggerTimer "Z Timer"
"/Applications/Bome MIDI Translator Pro.app/Contents/MacOS/MIDITranslatorPro" -triggerTimer "Z Timer"

All previous lines will trigger the Perform and also open the main window of BMTP in the frontmost.

If you want to keep BMTP hidden or minimized, add -noShow at the end of the lines and Terminal will only trigger the Perform or Timer actions:

open -n -a "Bome MIDI Translator Pro" --args -triggerPerform "Z Perform Action 1" -noShow
open -n -a "Bome MIDI Translator Pro" --args -triggerTimer "Z Timer" -noShow
  1. APPLESCRIPT

You can trigger Perform actions using the following code in AppleScript. Just change the name of the variable actionName:

set appName to quoted form of "/Applications/Bome MIDI Translator Pro.app/Contents/MacOS/MIDITranslatorPro"
set dontShowMainWindow to " -noShow" --don't show the main window if BMTP is hidden or minimized
set triggerName to " -triggerPerform "
------
set actionName to quoted form of "Z Perform Action 1" --change "Z Perform Action 1" for the name of your Incoming Perform action
------
set commandLine to appName & triggerName & actionName & dontShowMainWindow
do shell script commandLine
------
return 1

And for triggering Timers:

set appName to quoted form of "/Applications/Bome MIDI Translator Pro.app/Contents/MacOS/MIDITranslatorPro"
set dontShowMainWindow to " -noShow" --don't show the main window if BMTP is hidden or minimized
set triggerName to " -triggerTimer "
------
set actionName to quoted form of "Z Timer" --change "Z Timer" for the name of your Incoming Timer action
------
set commandLine to appName & triggerName & actionName & dontShowMainWindow
do shell script commandLine
------
return 1

If you want to trigger Timer or Perform actions opening the main window of BMTP , change the following line in these Applescripts:

set commandLine to appName & triggerName & actionName
1 Like

Wow, thanks for posting this!

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Hi,
it seems that any arguments passed with open --args are discarded by MacOS when there is already an instance running.

But I found a convenient solution!

If you keep this option checked in MT Pro’s settings:
[x] only allow one instance (recommended)

Then you can use the open command with the -n parameter so that a new instance of MIDI Translator Pro is invoked. This seems counter-intuitive, but now, MT Pro will take care on its own of passing the arguments to the running instance, and of closing the new instance created by by the open command.

Also, with open -a it is not necessary to specify the full path of the application bundle. So a full Terminal command looks like this:

open -n -a "Bome MIDI Translator Pro" --args -triggerPerform "Z Perform Action 1"

@jordikt , I took the liberty to edit your post above accordingly. I’ve also changed the argument format to use the more macOS-like dash-command -triggerPerform instead of the Windows-style slash /triggerPerform.

1 Like