Executing UI Scripts
You can execute UI scripts for the macro page and even for each template. The Script section can be found in the Properties section in the lower left of the Macro Page Designer. Just as with the Lua Script MIDI Module, you can write your scripts with the internal editor or an external editor. See steinberg.help / MIDI Modules Reference / Lua Script for more details.
- In the GUI Tree of the Macro Page Designer, select the element that has the macro page attached. Alternatively, select a control element, then go to the Show Templates tab and click Edit Element.
- In the Properties section in the lower left of the Macro Page Designer, go to the Script section.
- Click Edit Script to open the internal Script Editor, then enter your script and press OK. Alternatively, click Load Script and select a script file from disk.
Show/Hide Output Messages
The Output Messages section for the UI scripts is hidden by default.
- In the toolbar of the Macro Page Designer, click Show/Hide Script Output Messages to show or hide the Output Messages below the Resource / Library Browser.
The Output Messages section displays the messages of all UI scripts. The UI script the message belongs to is indicated by a prefix.
Addressing the Elements of the Program
A UI script cannot address the elements of a program directly. To address a program and its elements from the UI script, you must use getElement.
Example
-- must be executed as UI script!
-- print the name and type of the element that has the macro page attached
element = getElement()
print(element.name, element.type)
-- print the name and type of the parent element
if element.parent then
print(element.parent.name, element.parent.type)
end
1 Comment
Sabine Pfeifer
proofread done