You can try, but I doubt it’ll work. The plugin requests a list of global functions from the JavaScript Jint engine, but this happens immediately when the main script loads. I’m unsure if exports are included at that point.
Yes. I was not sure it was really safe so I went another route, shared here.
I believe I’ve found a way to make exported event handlers work with globalThis. I haven’t tested it yet; I just wanted to mention that it should hopefully work in the next update.
Hello,
It seems there is a problem with receiving Sysex data in js.
I have the following in a backgouund script :
/*
Selected Track : Name
[(init){@g_tname_sel:"_Track_"}]
Reinit and accumulate, Fire global on last one
[(sysex:F0 6A 00 XX F7){@l_tname_sel:#IF(HEXVALUE(MID(@e_sysex,1,1))=1, RIGHT(@e_sysextext, 8), CONCAT(@l_tname_sel, RIGHT(@e_sysextext, 8)))#}
{@l_tnupdt:#IF(HEXVALUE(MID(@e_sysex,1,1))=HEXVALUE(MID(@e_sysex,2,1)),1,0)#}]
[(@l_tnupdt:1){@g_tname_sel:#SUBSTITUTE(TRIM(@l_tname_sel),CHAR(39),CHAR(34))#}{@l_tnupdt:0}]
*/
var receivedSysex = null;
var mySysex = [];
function OnInit() {
global.set("g_tname_sel", "_Track_");
}
function OnSysExReceived(sysexdata) {
// Sysex needs some improvement, maybe by adding more arguments, such as providing text
receivedSysex = sysexdata;
mySysex = Array.from(sysexdata)
console.warn("Sysex was received:" + mySysex);
global.set("SysexReceived", sysexdata);
}
Now the log file shows :
[BackgroundScript2 Sysex was received:106,0,18,80,105,97,110,111,32,82,97]
so the first two bytes are 6A 00
18 → chunk 1 of 2 (and later i receive 34` → chunk 2 of 2)
and the rest is ASCII chars for “Piano Ra”.
So it should be easy to process but the problem is that it triggers the “Please wait, the plugin is loading …” after being called several times and when I open the variables window.
I have seen similar issues, and I believe it’s more related to the Variable window than sysex. I haven’t been able to reproduce your exact problem, but I will continue investigating to see if I can find the cause.
Thanks,
I tried to reproduce the problem and provide a log file but it’s not so easy.
The problem is also that in (some, not all) crash situations, it behaves very badly. I can’t even sop & start the windows midi service and need to reboot my computer.
if that may help, this is my log file just after crash (I can’t upload it as usual).
2026-03-27 06:40:32.3867 43232930,50ms DEBUG 16 MidiController ListMidiPorts [Input ports: 'BMT 1','BMT 2','BMT 3','BMT 4','BMT 5','BMT 6','KAWAI USB MIDI','RME ARC','UCX Midi Port 1','UCX Midi Port 2']
2026-03-27 06:40:32.3867 0,04ms DEBUG 16 MidiController ListMidiPorts [Output ports: 'BMT 1','BMT 2','BMT 3','BMT 4','BMT 5','BMT 6','KAWAI USB MIDI','RME ARC','Synthé. de table de sons Microsoft GS','UCX Midi Port 1','UCX Midi Port 2']
2026-03-27 06:40:32.4505 63,78ms DEBUG 16 MidiController HandleConnection [OutPort(KAWAI USB MIDI) existence changed -> True]
2026-03-27 06:40:32.5147 64,23ms DEBUG 16 MidiController HandleConnection [InPort(KAWAI USB MIDI) existence changed -> True]
2026-03-27 08:37:08.9444 6996429,67ms DEBUG 57 GenericMidi OnPIDidDisappear [797783190b353a93bfb5b14aab797196]
2026-03-27 08:37:08.9444 0,04ms DEBUG 57 VariableWindow SetWindowClosed [797783190b353a93bfb5b14aab797196]
2026-03-27 08:37:09.4137 469,28ms DEBUG 17 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:37:09.6632 249,45ms DEBUG 56 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:37:09.6632 0,09ms DEBUG 56 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 propertyInspectorPresent]
2026-03-27 08:37:09.6636 0,31ms DEBUG 56 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:37:09.6679 4,39ms DEBUG 56 GlblSettingsBtn SaveSettings [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:37:09.6683 0,37ms DEBUG 56 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:37:11.4988 1830,44ms DEBUG 56 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:37:11.4988 0,03ms DEBUG 56 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:37:11.4988 0,00ms DEBUG 56 VariableWindow ShowVariablesWindow [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:37:11.6741 175,35ms DEBUG 17 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:37:11.6742 0,02ms DEBUG 17 GlblSettingsBtn VariableWindow [2813a49e1f8005679045a8bd7de66f12 Ready]
2026-03-27 08:38:01.4422 49768,03ms DEBUG 5 GlblSettingsBtn PIDidDisappear [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:38:01.4422 0,02ms DEBUG 5 VariableWindow SetWindowClosed [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:38:01.7650 322,75ms DEBUG 15 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 property_inspector : propertyInspectorConnected]
2026-03-27 08:38:02.0149 249,92ms DEBUG 13 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 True : propertyInspectorPresent]
2026-03-27 08:38:02.0149 0,02ms DEBUG 13 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 propertyInspectorPresent]
2026-03-27 08:38:02.0152 0,28ms DEBUG 13 GenericMidi SaveSettings [da06dccd49bf5b86c235c85d2481ecd9 OutPort(BMT 4) InPort(BMT 5) Channel(0) Command(CC)]
2026-03-27 08:38:02.0157 0,53ms DEBUG 13 GenericMidi SendToPI [da06dccd49bf5b86c235c85d2481ecd9 OutPort(BMT 4) InPort(BMT 5) Channel(0) Command(CC)]
2026-03-27 08:38:02.1331 117,37ms DEBUG 13 GenericMidi OnPIDidDisappear [da06dccd49bf5b86c235c85d2481ecd9]
2026-03-27 08:38:02.1331 0,02ms DEBUG 13 VariableWindow SetWindowClosed [da06dccd49bf5b86c235c85d2481ecd9]
2026-03-27 08:38:02.2973 164,21ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:38:02.5469 249,57ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:38:02.5469 0,02ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 propertyInspectorPresent]
2026-03-27 08:38:02.5472 0,28ms DEBUG 13 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:38:02.5479 0,73ms DEBUG 13 GlblSettingsBtn SaveSettings [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:38:02.5481 0,22ms DEBUG 13 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:38:06.2264 3678,31ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:38:06.2265 0,02ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:38:06.2265 0,00ms DEBUG 13 VariableWindow ShowVariablesWindow [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:38:06.3364 109,94ms DEBUG 3 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:38:06.3364 0,03ms DEBUG 3 GlblSettingsBtn VariableWindow [2813a49e1f8005679045a8bd7de66f12 Ready]
2026-03-27 08:39:12.2244 65887,96ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:39:12.2357 11,31ms DEBUG 7 GlobalSettings ReceivedGlobalSettings [start]
2026-03-27 08:39:12.2357 0,03ms DEBUG 7 GlobalSettings DecipherJson [Global settings item count=68]
2026-03-27 08:39:12.2391 3,37ms DEBUG 7 Throttle ThrottleMode [ThrottleMode set to Unlimited]
2026-03-27 08:39:12.2391 0,03ms DEBUG 7 GlobalSettings DecipherKeyWords [Found EnableJavascript]
2026-03-27 08:39:12.2401 0,96ms DEBUG 7 GlobalSettings WriteGlobalSettingsFile [file updated]
2026-03-27 08:39:12.2401 0,04ms DEBUG 7 BgScriptCtrl AreGlblChanged [False]
2026-03-27 08:39:12.2401 0,00ms DEBUG 7 GlobalSettings ReceivedGlobalSettings [end]
2026-03-27 08:42:18.8662 186626,07ms DEBUG 60 GlblSettingsBtn PIDidDisappear [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:42:18.8663 0,06ms DEBUG 60 VariableWindow SetWindowClosed [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:42:19.0582 191,95ms DEBUG 60 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 property_inspector : propertyInspectorConnected]
2026-03-27 08:42:19.3093 251,06ms DEBUG 13 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 True : propertyInspectorPresent]
2026-03-27 08:42:19.3093 0,04ms DEBUG 13 GenericMidi OnSendToPlugin [da06dccd49bf5b86c235c85d2481ecd9 propertyInspectorPresent]
2026-03-27 08:42:19.3097 0,36ms DEBUG 13 GenericMidi SaveSettings [da06dccd49bf5b86c235c85d2481ecd9 OutPort(BMT 4) InPort(BMT 5) Channel(0) Command(CC)]
2026-03-27 08:42:19.3100 0,32ms DEBUG 13 GenericMidi SendToPI [da06dccd49bf5b86c235c85d2481ecd9 OutPort(BMT 4) InPort(BMT 5) Channel(0) Command(CC)]
2026-03-27 08:42:19.7649 454,87ms DEBUG 13 GenericMidi OnPIDidDisappear [da06dccd49bf5b86c235c85d2481ecd9]
2026-03-27 08:42:19.7649 0,01ms DEBUG 13 VariableWindow SetWindowClosed [da06dccd49bf5b86c235c85d2481ecd9]
2026-03-27 08:42:19.9222 157,35ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:20.1718 249,58ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:20.1718 0,02ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 propertyInspectorPresent]
2026-03-27 08:42:20.1721 0,31ms DEBUG 13 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:42:20.1728 0,67ms DEBUG 13 GlblSettingsBtn SaveSettings [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:42:20.1733 0,48ms DEBUG 13 GlblSettingsBtn SendToPI [2813a49e1f8005679045a8bd7de66f12 Row:1, Column:3, Device:Stream Deck +]
2026-03-27 08:42:21.9114 1738,14ms DEBUG 17 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:21.9188 7,42ms DEBUG 13 GlobalSettings ReceivedGlobalSettings [start]
2026-03-27 08:42:21.9189 0,03ms DEBUG 13 GlobalSettings DecipherJson [Global settings item count=68]
2026-03-27 08:42:21.9243 5,42ms DEBUG 13 Throttle ThrottleMode [ThrottleMode set to Unlimited]
2026-03-27 08:42:21.9243 0,03ms DEBUG 13 GlobalSettings DecipherKeyWords [Found EnableJavascript]
2026-03-27 08:42:21.9254 1,09ms DEBUG 13 GlobalSettings WriteGlobalSettingsFile [file updated]
2026-03-27 08:42:21.9255 0,04ms DEBUG 13 BgScriptCtrl AreGlblChanged [False]
2026-03-27 08:42:21.9255 0,00ms DEBUG 13 GlobalSettings ReceivedGlobalSettings [end]
2026-03-27 08:42:23.5027 1577,25ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:23.5027 0,03ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:42:23.5027 0,00ms DEBUG 7 VariableWindow ShowVariablesWindow [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:42:23.6110 108,29ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:23.6111 0,02ms DEBUG 13 GlblSettingsBtn VariableWindow [2813a49e1f8005679045a8bd7de66f12 Ready]
2026-03-27 08:42:57.0825 33471,45ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:57.0825 0,02ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:42:58.0984 1015,87ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:58.0984 0,03ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:42:59.8385 1740,08ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:42:59.8385 0,02ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 1]
2026-03-27 08:43:15.7531 15914,53ms DEBUG 13 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:43:15.7531 0,02ms DEBUG 13 GlblSettingsBtn VariableWindow [2813a49e1f8005679045a8bd7de66f12 No]
2026-03-27 08:43:15.7531 0,00ms DEBUG 13 VariableWindow CloseVariablesWindow [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:43:18.4104 2657,36ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:43:18.4105 0,02ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12 2]
2026-03-27 08:43:18.4105 0,00ms DEBUG 7 VariableWindow ShowVariablesWindow [2813a49e1f8005679045a8bd7de66f12]
2026-03-27 08:43:18.5017 91,26ms DEBUG 7 GlblSettingsBtn OnSendToPlugin [2813a49e1f8005679045a8bd7de66f12
2026-03-27 08:43:18.5018 0,02ms DEBUG 7 GlblSettingsBtn VariableWindow [2813a49e1f8005679045a8bd7de66f12 Ready]
2026-03-27 08:51:06.5997 468097,98ms DEBUG 15 DeviceList ConnectDevice [Setting device connected, a5f790040447e8500ddb5448dd872b2c:Stream Deck +]
2026-03-27 08:51:06.5998 0,06ms DEBUG 15 devconEvent WillTriggerCommand [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 (deviceconnected:Stream Deck +) Event met, device found and connected (Stream Deck +)]
2026-03-27 08:51:06.5998 0,02ms DEBUG 15 Command LockCommand [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 Command locked]
2026-03-27 08:51:06.5998 0,00ms DEBUG 15 ScriptEngine Event_Common [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 Executing command (deviceconnected:Stream Deck +){cc:11,0,127}]
2026-03-27 08:51:06.5998 0,00ms DEBUG 15 ScriptEngine AddBuiltinVariables [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 Adding reference variables]
2026-03-27 08:51:06.5999 0,05ms DEBUG 15 devconEvent SetBuiltinVariables [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 ID=(), Name=(Stream Deck +), Type=(StreamDeckPlus), Size=(Rows: 2 Columns: 4)]
2026-03-27 08:51:06.5999 0,05ms DEBUG 15 ScriptEngine RunActionList [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 (deviceconnected:Stream Deck +){cc:11,0,127}]
2026-03-27 08:51:06.5999 0,01ms DEBUG 15 ccAction Execute [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 sending Control 0, Value 127]
2026-03-27 08:51:06.5999 0,00ms DEBUG 15 Connection Send_ControlChange [55102E3345364F0F98BA015C10E77C96 Sending Channel(10), Control(0), Value(127)]
2026-03-27 08:51:06.6002 0,31ms DEBUG 15 MidiController Send_ControlChange [55102E3345364F0F98BA015C10E77C96 message successfully sent: ControlChangeMessage, MidiIn:BMT 5, MidiOut:BMT 4, Channel:10, Control,:0, Value:127]
2026-03-27 08:51:06.6003 0,04ms DEBUG 15 MidiStateCtrl SaveMidiState [55102E3345364F0F98BA015C10E77C96 Saving state for ControlChangeMessage, MidiIn:BMT 5, MidiOut:BMT 4, Channel:10, Control,:0, Value:127, time=27/03/2026 08:51:06]
2026-03-27 08:51:06.6003 0,03ms DEBUG 15 ScriptEngine ClearBuiltinVariables [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 Reference variables removed]
2026-03-27 08:51:06.6003 0,01ms DEBUG 15 Command ReleaseCommand [BackgroundScript1:55102E3345364F0F98BA015C10E77C96 Command released]
2026-03-27 08:51:06.6105 10,15ms DEBUG 19 MidiStateCtrl SaveMidiState [ Saving state for ControlChangeMessage, MidiIn:BMT 5, MidiOut:, Channel:3, Control,:1, Value:0, time=27/03/2026 08:51:06]
2026-03-27 08:51:06.6105 0,04ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:ADE40F87E0494D1A96154582265FE81E (cc:4,0,0-9) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,02ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 (cc:4,1,0-1) Event match for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:F6BB9DE96E52490A9D56BF88C515F6C1 (cc:4,2,0-1) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:415857AD4DF24D47AFB157E084CBDFE0 (cc:3,0,1-10) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:A3074BBBDD9E47AEA3AD0E9528F619D4 (cc:3,1,1-10) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:98B0DD9745FD4C9CAEB9CB1408030226 (cc:3,2,1-10) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:7F8F071ABB114F7592D51DB768EA4381 (cc:3,3,1-10) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:3855E684ED834F5EA044B29CB7385736 (cc:3,4,1-10) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ccEvent WillTriggerCommand [BackgroundScript1:EBCC0BF2932B4414AEA77D49039D0E21 (cc:2,27,0-127) Event not met for cc (4/1/0)]
2026-03-27 08:51:06.6105 0,01ms DEBUG 19 Command LockCommand [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 Command locked]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ScriptEngine Event_Common [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 Executing command (cc:4,1,0-1){@g_sr:#@e_ccvalue#}]
2026-03-27 08:51:06.6105 0,00ms DEBUG 19 ScriptEngine AddBuiltinVariables [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 Adding reference variables]
2026-03-27 08:51:06.6106 0,04ms DEBUG 19 ccEvent SetValueVariables [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 channel=(4), control=(1), value=(0)]
2026-03-27 08:51:06.6106 0,01ms DEBUG 19 ccEvent SetBuiltinVariables [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 ccchannel=(4), cc=(1), ccvalue=(0)]
2026-03-27 08:51:06.6106 0,03ms DEBUG 19 ScriptEngine RunActionList [BackgroundScript1:7E0E0FAFA6E14612ABBD800B34791680 (cc:4,1,0-1){@g_sr:#@e_ccvalue#}]
2026-03-27 08:51:06.6114 0,78ms DEBUG 19 variableAction Execute [BackgroundScript1 Setting variable as int 'g_sr'='0']
2026-03-27 08:51:06.6115 0,12ms DEBUG 24 ScriptEngine_JS InvokeAsync [5f1dd93981e35a8c2845741c50ccbf8f Calling 'OnGlobalVariableChanged' with args=(g_sr, 0)]
2026-03-27 08:51:06.6115 0,01ms DEBUG 24 Button_C_Base CmddExStartStop [5f1dd93981e35a8c2845741c50ccbf8f: isStart=True, commandCount=0]
2026-03-27 08:51:09.7633 3151,75ms DEBUG 15 ValueController SaveValue [6dfe2d8769f4407f86276c3e00dd7a41_main updating previous value(18) new value(17)]
2026-03-27 08:51:09.7633 0,02ms DEBUG 15 DialScript DialRotate [6dfe2d8769f4407f86276c3e00dd7a41 tics=-1, value=17]
btw, talking about variables, I can see from the variable window help (in a js scripted object) that various JavaScript types are now recognized.
Also, in the script settings, there is the “classic” versus “extended” mode and I remember the discussions we had when extended mode was introduced.
Now i’m wondering how are these new JavaScript types are managed/converted by the legacy scripts (ex. Array, Objects, …) when they are referenced.
Any indication ?
Why can’t you upload log files?
That is a good question I haven’t thought about. The JavaScript variables are stored “as is”; an array will, for example, be stored as an array in the global variable. The variable controller will handle this, but it will probably break somehow when the variables are referenced from midiScripts.
Because “Please wait, the plugin is loading …” blocks everything IIRC even access to the log file section.
On the occasion, may I suggest a small improvement.
We have the OnGlobalVariableChanged(varName, value) function.
Could we have an additional OnGlobalVariableChanged(“myvar”, value) that would only return the value of myvar. It would mimic the (@myvar:*) event in the legacy scripts.
Why not upload the log file after you restart the plugin?
That is not a valid JavaScript function definition.
Yes … I overlooked this.
What about registerVarChangeCallBack (string, fn) … would execute the function fn when the variable named string changes, and eventuially pass the value to fn.
As a replacement I have the following common function :
var callbacks = {}; // variableName → function
function registerCallback(gVars) {
for (const varName in gVars) {
callbacks[varName] = gVars[varName]; // single function
}
}
function notifyChange(varName, value) {
if (!callbacks[varName]) return;
callbacks[varName](value); // direct call, no loop
}
// Expose functions
module.exports = {registerCallback, notifyChange};
with usage like this :
const {registerCallback, notifyChange} = require('./GlobalVariablesHandler.js');
// Key/Value pairs: variable name, function to be called when a variable changes
const gVars = {
g_pp: RefreshDisp,
g_t_img_idx: RefreshDisp
};
// Register callbacks
registerCallback(gVars);
// Trigger callback when a variable changes
function OnGlobalVariableChanged(varName, value) {notifyChange(varName, value);}
It is aimed at replacing [(@g_pp:)(@g_t_img_idx:){… refresh display here … }]
and I can live with it, but I thought it could be simplified having something in the core.
To me, it just looks like a more complicated way to do this:
function OnGlobalVariableChanged(name, value) {
switch (name) {
case "myvar":
// ...
break;
}
}
Currently, all event methods function the same way: When an event happens, the method is invoked, and you must determine if the event is something you should handle.
Making something else for this particular event may potentially make it easier to handle, but would make it, from a structural point of view, work differently from all other event handlers.
Yes .. after much thinking
i was about to reach the same conclusion. Thanks.
I’m working on some changes for access to global variables. I realized that the object name “global” wasn’t appropriate because there is already a “global” definition in JavaScript.
My plan is to change “global” to “globalvar”. Is this a reasonable name change, or should I abbreviate it to “gvar”, or something else?
At the same time, I will add syntax to access the variables directly, so instead of doing…
var MyLocalVar = global.get(“MyGlobalVar“);
global.set(“MyGlobalVar“, 10);
…you can do…
var MyLocalVar = globalvar.MyGlobalVar;
globalvar.MyGlobalVar = 10;
The previous get/set functions are still valid (with the new object name), so you can continue to use them if you find that better.
gvar is fine in my optinion.
I would even remove global.get/set to avoid ambiguity.
Changes in this version:
MIDI Driver
A new MIDI driver has been added (in Windows) and set as the default driver unless overridden with keywords. The new MIDI driver is built on the MIDI Service SDK and is a direct connection to the new MIDI Service, so hopefully it will work flawlessly with the MIDI Service.
The plugin now has three different MIDI connections, depending on keywords:
- No keyword => The MIDI Service SDK connection.
- “legacyMIDI” => The WinMM framework, “Windows Multimedia and MIDI”, released with Windows 3.0 in 1991. Yes, 35 years ago!

- “WinRTMIDI” => The WinRT framework, “Windows Runtime”, released with Windows 8 in 2012. This was the driver used in the previous beta version when no keyword was added.
The driver selection adapts to the "best option available,” based on the keyword, if any. Without a keyword, the plugin will attempt to connect to the MIDI Service and, if successful, use that driver. If it fails to connect to the MIDI Service, it will try to connect to the WinRT framework, and if that also fails, it will connect to WinMM. With the WinRTMIDI keyword present, it will try to connect to the WinRT framework, and if that fails, it will connect to WinMM. When the legacyMIDI keyword is present, it connects to WinMM.
The MIDI Service is built on top of WinRT, so WinRT is used both without a keyword and with “WinRTMIDI”. For Cubase, this means that the “Use Device WinRT MIDI” checkbox in the MIDI Port Setup should be checked. I don’t know how other DAWs are handling this.
Bug fixes
I found and fixed some issues where the “loading page” suddenly appeared. One issue was a deadlock situation when the Variable window was being displayed while a variable was being changed from JavaScript. Another issue was a problem with sending and receiving sysex messages.
The variable window
Some minor fixes have been made. JavaScript arrays are better displayed; in some cases, they were not displayed correctly in the previous version. The variable types for “not referenced global” are now displayed with variable types aligned with the script type for the button/dial whose variable window is opened, regardless of the script type used to create the variable.
The global object
Breaking change! The “global” object is replaced by “gvar”. Global variables can now be accessed directly by name ‘gvar.MyVar = 10’ instead of ‘gvar.set(“MyVar”, 10)’. The old get/set functionality is still available.
Script migration
The Generic MIDI button and dial now feature a “Migrate to JavaScript” button. Pressing this button, with a midiScript loaded, will trigger a migration function that attempts to convert the midiScript to JavaScript. There will be no visual response when you press the button; instead, the migration function will save the migrated script to the clipboard, allowing you to paste it into a text editor after pressing the button.
Expressions in #…# will be translated into a func.eval() call, which invokes the function library, and the migration function will add some helper functions to enable this. This will increase the chances that the migrated scripts run successfully after migration, but the final approach will likely be (for you) to replace them with native JavaScript functions instead of calling the functions library.
I do not expect migrated midiScripts to be “final” after a migration, but it will give you a JavaScript skeleton with a solid structure to continue with.
I am not at all sure this functionality will make it to the published version. What do you think?
Release
My plan is to release this version without adding anything more. I think you guys have applied more pressure on the JavaScript feature than I have; do you believe it’s ready to be released?
I have a few problems :
- I don’t know if its normal but the port enumeration has changed.
I used BMT4 (Out) and BMT5 (In) before, (with the new midi stack nothing changed).
Now they are signaled as [not present] in the editor and instead i have BMT4 (6) and BMT5 (7) to choose from. - my scripts are now very long to respond compared with the previous version
This seems to be done by the MIDI Service. It only happens for Bome ports, I don’t know why.
What do you mean by “long to respond”?
If you add the keyword “WinRTMIDI” in the advanced settings, you will go back to using the same MIDI driver as for the previous version. This should give you the original port names back. Do your scripts respond as expected with that setting?
I had the new midi service already installed with the previous plugin version and did’nt have the problem.
Yes, but the plugin didn’t use it in the previous version.
WinRTMIDI as a keyword do not change anything
