Is it me or the Macro script editor

Hi DodgingRain,

looking at your code, I would say, you shouldn’t use the UI script for your switch. Here’s why:

  • The UI script runs only when the UI is open. If you close the UI, the UI script won’t be executed anymore.
  • The parameters you define in the UI script cannot be automated.

Therefore, the major part of your script should be executed in the Lua Script MIDI module in the Program Tree. The UI script is mainly for adopting or customizing the UI, for example, switching pages, special control behavior, etc. In many cases you might not need the UI script at all.

If you execute your code in the Lua Script MIDI module, it will be executed even if the UI is closed. Instead of “getElement()” you have to write “this.parent”. Using “this.program” can be tricky, because if you load your instrument in HSSE, the element with the macro page won’t be equal to the element of the Program anymore. If the Lua Script MIDI module is a direct child of the element with the macro page, “this.parent” should work.

Regarding you question about adressing parameters by name: The names are more convenient and more readable. Adressing parameters via IDs is faster, but this is only needed for very demanding scripts. Till now, I never needed this.

I hope, these insights are of help for you.