### TopUp command example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_topup.html Example command to jump to the main instance of the fixture when subfixtures are selected. Type this in the command line. ```plaintext User name[Fixture]>TopUp ``` -------------------------------- ### Start macro 2 Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_goplus.html Use this command to start macro 2. The syntax is Go+ Macro 2. ```grandMA3 command line User name[Fixture]>Go+ Macro 2 ``` -------------------------------- ### Example: Print cue names from first sequence using Children() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_object_children.html This example stores the handle for sequence 1 in the selected data pool, uses the Children() function to get a table of its child cues, and prints each cue's name. It includes error handling if the sequence is not found. ```Lua return function() -- Stores the handle for sequence 1 in a variable. local mySequence = DataPool().Sequences[1] if mySequence ~= nil then -- Use the "Children()" funciton to store a table with all the children in a new variable. local cues = mySequence:Children() -- For loop that uses the length operator on the cue variable. for i = 1, #cues do -- Text is printed for each child. Printf("Sequence 1 Child " .. i .. " = " .. cues[i].name) end else ErrPrintf("Sequence could not be found.") end end ``` -------------------------------- ### OSC Command Line Examples Source: https://help.malighting.com/grandMA3/2.5/HTML/remote_inputs_osc.html Examples of sending OSC commands to control the grandMA3 command line. Each example uses the /cmd address with string type 's' and command syntax. ```text SendOSC 1 "/cmd,s,FaderMaster Page 1.201 At 50" ``` ```text SendOSC 1 "/cmd,s,FaderMaster Page 1.201 At 50 Fade 5" ``` ```text SendOSC 1 "/cmd,s,Fixture 1 At 75" ``` ```text SendOSC 1 "/cmd,s,Go+ Exec 402" ``` ```text SendOSC 1 "/cmd,s,Patch Fixture 1 3.42" ``` -------------------------------- ### Copy Cue 1 At Cue 2 /Release Example Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_release.html Example command line entry to copy cue 1 to cue 2 using released values. ```grandMA3 User name[Fixture]>Copy Cue 1 At Cue 2 /Release ``` -------------------------------- ### Up keyword example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_up.html Example command to go back to the main fixture in the fixture sheet in an upward manner. ```plaintext User name[Fixture]>Up ``` -------------------------------- ### Example: SaveShow /Enumerate command Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_enumerate.html Example command line input to enumerate a show file. The user name is shown as 'Fixture' and the command is 'SaveShow /Enumerate'. ```text User name[Fixture]>SaveShow /Enumerate ``` -------------------------------- ### Record Timecode 3 Example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_record.html Starts recording timecode 3 in the timecode pool. Type this command in the command line after entering the Record keyword. ```grandMA3 Command Line User name[Fixture]>Record Timecode 3 ``` -------------------------------- ### Select GridPosition layer example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_gridposition.html Example command line input to select the GridPosition layer. Type 'GridPosition' after the prompt. ```plaintext User name[Fixture]>GridPosition ``` -------------------------------- ### Example: Print dump of channel function using GetChannelFunction Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getchannelfunction.html This example selects the first fixture in the current selection, retrieves the UI Channel Index and Attribute Index for the Dimmer attribute, and prints the dump of the channel function. It uses GetAttributeIndex, GetUIChannelIndex, and GetChannelFunction. The example ends with an error message if no fixture with a Dimmer is selected. ```lua return function() -- Select the first fixture in the current selection. local subfixtureIndex = SelectionFirst() -- End the function if there is no selection. if subfixtureIndex == nil then ErrPrintf("Please select a fixture with a Dimmer") return end -- Get the Attribute index and UIChannel index. local attributeIndex = GetAttributeIndex("Dimmer") local uiChannelIndex = GetUIChannelIndex(subfixtureIndex,attributeIndex) Printf("The UIChannel Index is: %i. The Attribute Index is: %i. ",uiChannelIndex, attributeIndex) -- End the function if any of the index return nil. if (attributeIndex == nil or uiChannelIndex == nil) then ErrPrintf("Something wrong happened, maybe your first selected fixture don't have a Dimmer - Please try again") return end -- The following prints the dump for the dimmer channel function. Printf("=============== START OF DUMP ===============") GetChannelFunction(uiChannelIndex,attributeIndex):Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Start macro 5 Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_macro.html Starts macro 5 using the default Go+ function. ```grandMA3 command line Macro 5 ``` -------------------------------- ### DMXLayer Command Example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_dmx_layer.html Example command line entry showing the DMXLayer keyword being typed after the prompt. ```plaintext User name[Fixture]> DMXLayer ``` -------------------------------- ### CreateMultiPatch Example Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_createmultipatch.html Creates two multi patch fixtures for the first fixture (excluding the "Universal" fixture) in the patch. It changes the destination to the Patch, gets the fixture handle, builds a table, counts elements, creates an undo text, calls CreateMultiPatch, and prints the result or an error. ```lua return function() -- Enter Patch. Cmd("ChangeDestination Root"); -- Enter the SetupPatch. Cmd("ChangeDestination 'ShowData'.'Patch'"); -- Get the handle for the first fixture in the patch. local myFixture = Patch().Stages[1].Fixtures[2] -- Add the handle a list element in an table. local myFixtureTable = {myFixture} -- Add a variable with the amount of multipatch fixtures needed. local multiPatchAmount = 2 -- Count the number of elements in the fixture table and store in a variable. local count = 0 for _ in pairs(myFixtureTable) do count = count + 1 end -- Create an unto text string. local undoText = string.format("Create %d multipatch fixtures for up to %d fixtures", multiPatchAmount, count) -- Create the multipatch fixtures to the each fixture handle in the table and store the returned value. local multiPatchAmount = CreateMultiPatch(myFixtureTable, multiPatchAmount, undoText) if multiPatchAmount ~= nil then Printf(multiPatchAmount .. " multi patch objects was created") else Printf("An error occured") end -- Return the command line destination to the root. Cmd("ChangeDestination Root") end ``` -------------------------------- ### Copy Cue 1 At Cue 5 /Default Example Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_default.html Example command to copy cue 1 to cue 5 using default values. Entered in the command line as shown. ```grandMA3 Copy Cue 1 At Cue 5 /Default ``` -------------------------------- ### LogOut command example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_logout.html Example command line input to log out the user and change to guest user. The prompt shows the current user and fixture. ```plaintext User name[Fixture]>LogOut ``` -------------------------------- ### MemoryInfo command example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_memoryinfo.html Example command line input to check memory usage. The prompt 'User name[Fixture]>' is shown before the command. ```plaintext User name[Fixture]>MemoryInfo ``` -------------------------------- ### Enable Blind example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_blind.html Example command to enable Blind and disable the output of the programmer. The command line prompt is shown as 'User name[Fixture]>'. ```plaintext User name[Fixture]>Blind ``` -------------------------------- ### Start loaded cues with Go+ Loaded Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_loaded.html Type 'Go+ Loaded' in the command line to start several loaded cues. Requires at least one cue in Load status. ```grandMA3 command line User name[Fixture]>Go+ Loaded ``` -------------------------------- ### ReloadAllPlugins Example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_reloadallplugins.html Example command line input to restart the content of external Lua files after programming using Lua. ```plaintext User name[Fixture]>ReloadAllPlugins ``` -------------------------------- ### Acceleration keyword command line examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_acceleration.html Two command line examples for the Acceleration keyword. The first sets the layer to accelerate. The second sets the acceleration curve of the dimmer to 70. ```plaintext Acceleration ``` ```plaintext At Acceleration 70 ``` -------------------------------- ### Load Show or Run Plugin at Startup with SHOW/RUNPLUGIN Parameters Source: https://help.malighting.com/grandMA3/2.5/HTML/shf_organize.html Command-line shortcuts to launch grandMA3 onPC with a show file or a plugin during startup. Add the SHOW or RUNPLUGIN parameter to the shortcut that launches the onPC application. x represents the grandMA3 version number; y represents the number of the Lua component inside the plugin to start (e.g., 1). It is not recommended to specify a path for the plugin, although it can be placed in a subfolder. Do not use spaces in a show file name when loading a show during startup. ```text "C:\Program Files\MALightingTechnology\gma3_x.x.x\bin\app_system.exe" HOSTTYPE=onPC SHOW="startshow.show" ``` ```text "C:\Program Files\MALightingTechnology\gma3_x.x.x\bin\app_system.exe" HOSTTYPE=onPC RUNPLUGIN=\"startplugin.xml\"-y ``` -------------------------------- ### Print Mouse Object Information with MouseObj():Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_mouseobj.html Prints the information of the mouse object using the Dump() function. The example uses MouseObj() to get the handle and then calls Dump() on it, wrapping the output with start and end markers. ```lua return function() -- Print all informatin about the MouseObj object Printf("=============== START OF DUMP ===============") MouseObj():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### NetworkSpeedTest command examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_networkspeedtest.html Two command-line examples for the NetworkSpeedTest keyword. The first tests all consoles available in the network using 'Console Thru'; the second tests all devices in the session using 'Session'. ```grandMA3 NetworkSpeedTest Console Thru ``` ```grandMA3 NetworkSpeedTest Session ``` -------------------------------- ### AutoCreate single groups for FixtureTypes 9 and 10 Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_single.html Creates single fixture groups that contain all patched fixtures of fixture types 9 and 10, starting with group pool object 101. Requires the same setup as the previous example. ```grandMA3 command line AutoCreate FixtureType 9 + 10 At Group 101 /Single ``` -------------------------------- ### Print selected feature dump using SelectedFeature() and Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_selectedfeature.html This Lua function prints a dump of the selected feature object to the Command Line History. It uses SelectedFeature() to get the handle and calls Dump() on it, surrounding the output with start and end markers. The example is intended for use in a grandMA3 Lua environment. ```Lua return function () -- The following prints the dump for the selected feature object Printf("=============== START OF DUMP ===============") SelectedFeature():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Preview Sequence with /AutoStart "Single" Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_autostart.html Loads sequences 1 to 3 into preview mode and starts the last sequence. The /AutoStart option is set to "Single". ```grandMA3 command line User name[Fixture]>Preview Sequence 1 Thru 3 /AutoStart "Single" ``` -------------------------------- ### Call keyword examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_call.html These examples show how to use the Call keyword to apply an object or its content. The first calls view button 2.1, and the second calls macro 2. ```grandMA3 Call ViewButton 2.1 ``` ```grandMA3 Call Macro 2 ``` -------------------------------- ### Get(handle, string[, integer]) Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_object_get.html Documentation for the Get function in the grandMA3 Lua Object API, including description, arguments, return value, and an example. ```APIDOC ## Get(handle, string[, integer]) ### Description Returns a string with information about a specified property of the object, such as the object's name, class, or path. ### Syntax `Get(handle, string[, integer])` ### Arguments - **handle** (light_userdata) - Required - The handle of the object. Can be omitted when using colon notation. - **string** (string) - Required - The name of a valid property for the object. - **integer** (integer) - Optional - A valid role integer. When supplied, the returned value is a text string. ### Return - **string** - The value of the property. If the property is a boolean, returns "0" or "1" unless a role is defined; with a role, returns "No" or "Yes". ### Example ```lua return function () -- SelectedSequence() creates a handle to the selected sequence. local selectedSequence = SelectedSequence() -- Check if there is a selected sequence. If not, then exit the function. if selectedSequence == nil then ErrPrintf("The selected sequence could not be found.") return end -- Set a variable with the property name. local propertyName = "Tracking" -- Get the value of the property. local propertyValue = selectedSequence:Get(propertyName) local propertyValueString = selectedSequence:Get(propertyName, Enums.Roles.Edit) -- Return some feedback. if propertyValue ~= nil then Printf("The selected sequence's property " .. propertyName.. " has the value '" .. propertyValue .. "' and a string value of '" .. propertyValueString .. "'.") else ErrPrintf("The property could not be found.") end end ``` ``` -------------------------------- ### Create a MessageBox with states, inputs, selectors, and commands Source: https://help.malighting.com/grandMA3/2.5/HTML/key_rn_v2_0.html Creates a MessageBox with states, inputs, selectors, and commands, then prints the results. The example shows configuration keys such as message_align_h, message_align_v, timeout (commented out), and icon. ```lua local function main() -- create inputs: local states = { {order=4, name = "Color", state = true, group = 1}, {order=3, name = "Gobo", state = false, group = 1}, {order=2, name = "Position", state = true, group = 2}, {order=1, name = "Dimmer", state = false, group = 2} } local inputs = { {order=3, name = "Numbers Only", value = "1234", whiteFilter = "0123456789"}, {order=1, name = "Text Only", value = "TextOnly", blackFilter = "0123456789"}, {order=2, name = "Maximum 10 characters", value = "abcdef", maxTextLength = 10} } local selectors = { { name="Swipe Selector", selectedValue=2, values={Xylophone=3, Piano=2, Drums=3, ["some stuff"]=4}, type=0}, { name="Radio Selector", selectedValue=2, values={grandMA2=1, grandMA=2, grandMA3=3}, type=1} } local commands={ {value=1, name="Ok", order=4}, {value=0, name="Cancel", order=3}, {value=4, name="What?", order=2}, {value=3, name="Wait", order=1} } -- open messagebox: local resultTable = MessageBox( { title = "Messagebox example", message = "This is a message", message_align_h = Enums.AlignmentH.Left, message_align_v = Enums.AlignmentV.Top, states = states, inputs = inputs, selectors = selectors, commands = commands, backColor = "Global.Default", -- timeout = 10000, --milliseconds -- timeoutResultCancel = false, icon = "logo_small", titleTextColor = "Global.AlertText", messageTextColor = "Global.Text" } ) -- print results: Printf("Success = "..tostring(resultTable.success)) Printf("Result = "..resultTable.result) for k,v in pairs(resultTable.inputs) do Printf("Input '%s' = '%s'",k,v) end for k,v in pairs(resultTable.states) do Printf("State '%s' = '%s'",k,tostring(v)) end for k,v in pairs(resultTable.selectors) do Printf("Selector '%s' = '%d'",k,v) end end return main ``` -------------------------------- ### ShowSettings() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_showsettings.html Documentation for the ShowSettings() object-free function, including its description, arguments, return value, and an example. ```APIDOC ## ShowSettings() ### Description Returns a handle to the object at Root/ShowData/ShowSettings. ### Syntax ShowSettings() ### Arguments This function does not accept any arguments. ### Return - **Handle**: The function returns a handle to the ShowSettings object. ### Example ```lua return function () -- The following prints the dump for the object for the show settings Printf("=============== START OF DUMP ===============") ShowSettings():Dump() Printf("================ END OF DUMP ================") end ``` ``` -------------------------------- ### Paste Agenda with Date Option Source: https://help.malighting.com/grandMA3/2.5/HTML/key_rn_v1_7.html Use the /Date option to set a new start date when pasting an agenda event. The example sets the start date to 3.10.2042 for the second agenda event. ```grandMA3 command User name[Fixture]> Paste Agenda 2 /Date "3.10.2042" ``` -------------------------------- ### DeleteOtherVersion command example Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_deleteotherversion.html Deletes installation files for a specific software version on a Windows computer. The argument combines the release type and version XML file with the path to the installation packages directory, separated by a semicolon. ```grandMA3 command line DeleteOtherVersion "release_stick_v1.6.3.67.xml;C:/ProgramData/MALightingTechnology/installation_packages" ``` -------------------------------- ### Example: Dump current profile information Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_currentprofile.html This example prints information about the current user's profile using the Dump() function. It is a Lua function that returns a function, which when called, prints a start marker, dumps the profile data, and prints an end marker. ```Lua return function() -- Dumps information about the current executor page Printf("=============== START OF DUMP ===============") CurrentProfile():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### GetAttributeByUIChannel example: print native address of first attribute Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getattributebyuichannel.html This example gets a handle to the first fixture in the current selection, retrieves its UI Channel Index, and prints the native address of the attribute using GetAttributeByUIChannel. It demonstrates the usage of SelectionFirst, GetUIChannelIndex, and AddrNative. ```Lua return function() -- Get a handle to the first fixture in the current selection local fixtureIndex = SelectionFirst() -- Get the UI Channel Index number for the first attribute for the fixture local channelIndex = GetUIChannelIndex(fixtureIndex,0) -- Print the native address for the attribute with the handle Printf("The native addr for the attribute is: %s",GetAttributeByUIChannel(channelIndex):AddrNative()) end ``` -------------------------------- ### Release Examples (Command Line) Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_release.html Command line examples for entering release values in the programmer. The first releases all attributes of the selected fixtures, the second targets the attribute 'Pan', and the third releases fixture 1. ```command User name[Fixture]>Release ``` ```command User name[Fixture]>Release Attribute "Pan" ``` ```command User name[Fixture]>Release Fixture 1 ``` -------------------------------- ### Get first child with Ptr() and Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_object_ptr.html Example usage of the Ptr() function to get a handle to the first child of the selected sequence. It checks for nil handles, prints an error if no sequence is selected, and uses Dump() to print object information. The colon notation omits the handle argument. ```Lua return function() -- SelectedSequence() creates a handle to the selected sequence. local selectedSequence = SelectedSequence() -- Check that a handle was returned - if not then exit function. if selectedSequence == nil then ErrPrintf("There is no selected sequence.") return end -- Get a handle to the first child object. local firstChild = selectedSequence:Ptr(1) -- Print some feedback. if firstChild ~= nil then Printf("=============== START OF DUMP ===============") firstChild:Dump() Printf("================ END OF DUMP ================") else ErrPrintf("The object do not have a child object.") end end ``` -------------------------------- ### Example: View version details Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_version.html Type 'Version' in the command line to display version details in the command line history window. ```plaintext User name[Fixture]>Version ``` -------------------------------- ### DirList example with GetPath and filter Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_dirlist.html This example prints the show files in the showfile directory. It uses the GetPath() function to obtain the path and a filter to list only .show files. The returned table elements contain name, size, and time keys. ```lua return function () -- Get the path to the show files. local path = GetPath(Enums.PathType.Showfiles) -- Make a filter to only list .show files. local filter = "*show" -- Use the DirList function to get a table of the files. local returnTable = DirList(path, filter) -- Print the information of the files in the returned table. for _, value in pairs(returnTable) do Printf(value['name'] .. " - Size: " .. value['size'] .. " bytes - Time: " .. os.date("%c", value['time'])) end end ``` -------------------------------- ### Store into Cues with Wildcard Label Source: https://help.malighting.com/grandMA3/2.5/HTML/cue_store.html Use an asterisk as a wildcard to store into all cues whose labels start with "BO". This example merges the new value into those cues. ```plaintext User name[Fixture]>Store Cue "BO*" /Merge ``` -------------------------------- ### Example: FirstDmxModeFixture with Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_firstdmxmodefixture.html This Lua example retrieves the handle for a 'Dimmer' fixture type, checks for its existence, then gets the 'Mode 0' DMX mode. If both exist, it calls FirstDmxModeFixture(fixtureDMXMode):Dump() to print information about the first matching fixture. It uses ErrPrintf for error feedback and Printf to delimit the dump output. ```lua return function () -- Get the handle for the Dimmer fixture. local fixtureTypeHandle = Patch().FixtureTypes['Dimmer'] -- Check if fixture type returned something and provide feedback. if fixtureTypeHandle == nil then ErrPrintf("The fixture type does not exist in this show. Try adding it or edit this plugin.") else -- Get the handle for the DMX mode of a Dimmer fixture. local fixtureDMXMode = fixtureTypeHandle.DMXModes["Mode 0"] -- Check if fixtureDMXMode returned something and provide feedback. if fixtureDMXMode == nil then ErrPrintf("The fixture type does not contain a 'Mode 0' DMX mode. Try adding it or edit this plugin.") else -- Dumps information about the first fixture matching the DMX mode. Printf("=============== START OF DUMP ===============") FirstDmxModeFixture(fixtureDMXMode):Dump() Printf("================ END OF DUMP ================") end end end ``` -------------------------------- ### Dump selected attribute information Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getselectedattribute.html This example prints the data connected to the handle returned by GetSelectedAttribute() using the Dump() function. It prints start and end markers around the dump output. ```lua return function() -- This example dumps all information about the currently selected attribute Printf("=============== START OF DUMP ===============") GetSelectedAttribute():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### List Objects and Macros Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_list.html These commands list objects in the show file. The first lists the first ten fixtures of the Fixture Edit Setup, the second lists all existing attributes, the third lists the first five groups of the group pool, and the fourth lists macros available to import from the default macro library folder on the first connected USB drive. ```grandMA3 command line User name[Fixture]>List Fixture Thru 10 ``` ```grandMA3 command line User name[Fixture]>List Attribute ``` ```grandMA3 command line User name[Fixture]>List Group Thru 5 ``` ```grandMA3 command line User name[Fixture]>List Macro Library If Drive 2 ``` -------------------------------- ### CheckDMXCollision example with selection and feedback Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_checkdmxcollision.html Example Lua function that checks DMX collision for the first fixture in the current selection. It builds a DMX address string from universe and address, gets the DMX mode handle via GetSubfixture(SelectionFirst()).ModeDirect, and calls CheckDMXCollision with optional count and break_index. Prints feedback based on the boolean result. ```lua return function() -- Set the DMX universe - range 1-1024. local myDMXUniverse = 1 -- Set the DMX address in the universe - range 1-512. local myDMXAddress = 1 -- Set the optional count for the number of fixtures (break_index channel amount) to check. local myCount = 1 -- Set the optional break_index number for fixtures with multiple breaks. -- Default value is 0 to indicate the first break. local myBreakIndex = 0 -- Creates the string used for the DMX address. local startOfRange = string.format("%d.%03d", myDMXUniverse, myDMXAddress) -- Check if there is a selection and exit if there isn't. if SelectionFirst() == nil then Printf("Please make a selection and try again.") return end -- This gets the handle for the first fixture a patched generic Dimmers 8-bit mode. local myDmxMode = GetSubfixture(SelectionFirst()).ModeDirect if myDmxMode == nil then -- Exit the function if the DMX mode returns nil. else -- Do the actual collision check and provide useful feedback. if CheckDMXCollision(myDmxMode, startOfRange, myCount, myBreakIndex) then Printf("The DMX address " .. startOfRange .. " is available.") return else Printf("The DMX address " .. startOfRange .. " cannot be used as a start address for this patch.") return end end end ``` -------------------------------- ### RemoteHID example command Source: https://help.malighting.com/grandMA3/2.5/HTML/comad_remotehid.html Example command to connect to a grandMA3 onPC with hostname "3D". After connection, the local screen turns olive green and only executors remain usable. End with MA + MA + Off or Shift + Ctrl + Alt + E. ```text User name[Fixture]>RemoteHID onPC "3D" ``` -------------------------------- ### Iterate through selection with SelectionNext() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_selectionnext.html This example prints the patch index and grid positions of all fixtures in the current selection. It uses SelectionFirst() to get the first fixture and SelectionNext() to loop through the rest. The plugin cancels if no fixture is selected. ```Lua return function() -- Store the return in a local variable local fixtureIndex, gridX, gridY, gridZ = SelectionFirst() -- Cancel the plugin if no fixture is selected assert(fixtureIndex,"Please select a (range of) fixture(s) and try again.") -- Loop that prints the index and gridpositions of all the fixtures in the selection while fixtureIndex do Printf('The fixture has index number: %i and gridposition %i / %i / %i', fixtureIndex, gridX, gridY, gridZ); -- Here is SelectionNext actually used to find the next fixture in the selection fixtureIndex, gridX, gridY, gridZ = SelectionNext(fixtureIndex) end end ``` -------------------------------- ### GetTopOverlay example with Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_gettopoverlay.html Opens the MenuSelector overlay, gets its handle with GetTopOverlay(1), then closes the overlay and dumps the handle's information if found. Uses coroutine.yield for delays and prints error feedback if the handle is nil. ```Lua return function() -- Open the MenuSelector overlay. Cmd('Menu "MenuSelector') -- Add a small delay. coroutine.yield(0.5) -- Get the handle for the overlay on the display with index 1. local overlayHandle = GetTopOverlay(1) -- Add a small delay. coroutine.yield(0.5) -- Close the MenuSelector overlay. Cmd('Menu "MenuSelector') -- Check if there is a handle and print appropriate feedback. if overlayHandle ~= nil then Printf("=============== START OF DUMP ===============") overlayHandle:Dump() Printf("================ END OF DUMP ================") else ErrPrintf("The Overlay UI object could not be found.") end end ``` -------------------------------- ### Print current environment with Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_currentenvironment.html Use this Lua function to print information about the current environment. It calls CurrentEnvironment() to get a handle and then Dump() to output the object's details. The output is wrapped with start and end markers for clarity. ```Lua return function() -- Dumps information about the current environment Printf("=============== START OF DUMP ===============") CurrentEnvironment():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Toggle Control Bar for display 1 using DefaultDisplayPositions() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_defaultdisplaypositions.html Accesses display 1 (child 1 of the default displays) and toggles the 'ShowMainMenu' setting, which controls the Control Bar visibility. The example uses the DefaultDisplayPositions() object to get the handle. ```Lua return function() -- Store a handle to display 1 (child 1 of the default displays). local display1 = DefaultDisplayPositions():Children()[1] -- Toggles the 'ShowMainMenu' setting. display1.ShowMainMenu = not display1.ShowMainMenu end ``` -------------------------------- ### LoadShow with /Path Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_path.html Loads the show file named 'Fabulous' from the '/test' subfolder on the USB drive (Drive 2). The path is relative to the root of the drive. ```grandMA3 command line User name[Fixture]>LoadShow "Fabulous" If Drive 2 /Path "/test" ``` -------------------------------- ### Execute Lua file with LuaFile keyword Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_luafile.html Executes the Lua file 'execute_example.lua' directly from the command line without importing it into the show file. The path must be absolute and include the file name with the .lua extension. ```grandMA3 command line LuaFile "C:\ProgramData\MALightingTechnology\gma3_1.6.3\shared\resource\lib_plugins\examples\execute_example\execute_example.lua" ``` -------------------------------- ### Print selected layout dump with SelectedLayout():Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_selectedlayout.html Use this Lua function to print all information about the selected layout to the Command Line History. The example calls SelectedLayout():Dump() between Printf statements to mark the start and end of the dump. No arguments are accepted. ```Lua return function () -- The following prints the dump for the selected layout object Printf("=============== START OF DUMP ===============") SelectedLayout():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Dump programmer part object with ProgrammerPart() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_programmerpart.html Returns a handle to the current programmer part object. This example calls Dump() on that handle to print information about the object, such as its name, class, path, properties, and children. The output is wrapped with start and end markers using Printf(). ```Lua return function () -- Dumps information about the current programmer part object. Printf("=============== START OF DUMP ===============") ProgrammerPart():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Key keyword command line examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_key.html These command line examples show how to use the Key keyword: Store Key 2 creates a new key, List Key lists all keys, Set Key 2 Property "Seed" "Concord Dawn" sets a password for a newly created key, and Set Key 2 Property "MANET" "No" disables key 2 for MAnet. ```grandMA3 command line User name[Fixture]>Store Key 2 ``` ```grandMA3 command line User name[Fixture]>List Key ``` ```grandMA3 command line User name[Fixture]>Set Key 2 Property "Seed" "Concord Dawn" ``` ```grandMA3 command line User name[Fixture]>Set Key 2 Property "MANET" "No" ``` -------------------------------- ### Set property value ranges via command line Source: https://help.malighting.com/grandMA3/2.5/HTML/rn_features-2-4.html Command line examples for setting a range of values for a property in a phaser recipe. The first sets FadeX to a range of 0 to 5 using Thru. The second changes only the starting value of FadeFromX to 4. ```command line User name[Fixture]>Set Cue 1 Part 0.1 Property "FadeX" "0 Thru 5" ``` ```command line User name[Fixture]> Set Sequence 1 Cue 1 Part 0.1 Property "FadeFromX" "4" ``` -------------------------------- ### GetFocus() with Dump() in Lua Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getfocus.html Use this Lua function to print all information about the object that currently has focus in the UI. It calls GetFocus() and then Dump() to retrieve and display the object's details. The example wraps the code in a return function and uses Printf to mark the start and end of the dump. ```lua return function() -- This example dumps all information about the object who currently got focus. Printf("=============== START OF DUMP ===============") GetFocus():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Assign View Using Keys Example Source: https://help.malighting.com/grandMA3/2.5/HTML/wvm_store_recall.html Key presses to assign view 4 to view button 7 on screen 1, followed by the resulting command line output. ```text Assign MA + X7 | View 4 At MA + X7 | View MA + X7 | View 1 . 7 Please ``` ```text User name[Fixture]>Assign View 4 At ViewButton 1.7 ``` -------------------------------- ### Dump display 1 information using DefaultDisplayPositions() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_defaultdisplaypositions.html Returns a handle to the default display positions and accesses child 1 (display 1). Uses the Dump() function to print information about the display object. The example prints start and end markers around the dump output. ```Lua return function() -- Store a handle to display 1 (child 1 of the default displays). local display1 = DefaultDisplayPositions():Children()[1] -- Dumps information about the display. Printf("=============== START OF DUMP ===============") display1:Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Set, get, and delete a user variable with UserVars() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_uservars.html Use this Lua example to set, retrieve, and delete a user variable via the grandMA3 UserVars() handle. It stores the handle in a local variable, sets an integer value with SetVar, prints it with GetVar and Printf, then deletes it with DelVar. ```Lua return function() -- Stores a local Lua variable with the handle for the user variables. local variableSection = UserVars() -- Sets a user variable with an integer value using the SetVar function. SetVar(variableSection, "myUserVar", 42) -- Prints the user variable using the GetVar function. Printf("The value of myUserVar is: " .. GetVar(variableSection, "myUserVar")) -- Deletes the user variable using the DelVar function. DelVar(variableSection, "myUserVar") end ``` -------------------------------- ### Load Show with /Type "Demo" Source: https://help.malighting.com/grandMA3/2.5/HTML/ok_type.html Loads a demo show from the demo shows folder by specifying /Type "Demo" with the LoadShow keyword. ```command User name[Fixture]>LoadShow "Demoshow_grandMA3.show" /Type "Demo" ``` -------------------------------- ### GetPathOverrideFor example: print macro folder override path Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getpathoverridefor.html Run on a console with a removable drive connected. It finds the first removable drive, gets the UserMacros path type, and prints the override path returned by GetPathOverrideFor. If no removable drive is found, it prints an error and exits. ```lua return function () -- Set a path for the first removable media. -- Set the initial value to nil. local myBasePath = nil -- Itereate the drives and find the first 'Removeable' drive and store the path. for _, value in ipairs(Root().Temp.DriveCollect) do local driveType = value.drivetype if driveType == "Removeable" then myBasePath = value.path break end end -- If no removeable drive was found, then provide feedback and exit the function. if myBasePath == nil then ErrPrintf("No removeable drive could be found. Please insert one and try again") return end -- Get the integer for the UserMacros path type. local myPathType = Enums.PathType.UserMacros -- Gey the string for the path override. local myOverridePath = GetPathOverrideFor(myPathType, myBasePath) -- Print the returned string. Printf("The path is: " .. myOverridePath) end ``` -------------------------------- ### Load keyword command examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_load.html Four command-line examples showing how to use the Load keyword to prepare an executor to jump to a specific cue. The first loads cue 3 on the selected executor; the second loads cue 5 on executor 114; the third loads cue +2 on executor 114; the fourth loads the previous cue on executor 114. The first example notes that after loading, the display toggles between Cue 3 and Cue "Name" to indicate the loaded cue. ```grandMA3 command line User name[Fixture]>Load Cue 3 ``` ```grandMA3 command line User name[Fixture]>Load Executor 114 Cue 5 ``` ```grandMA3 command line User name[Fixture]>Load +2 Executor 114 ``` ```grandMA3 command line User name[Fixture]>Load Previous Executor 114 ``` -------------------------------- ### Lua example using GetSubfixture and Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getsubfixture.html Use this snippet to print all information about the first fixture in a selection to the Command Line History. It checks for a selection with SelectionFirst(), stores the index, then calls GetSubfixture(fixtureIndex):Dump() between start and end markers. If no fixture is selected, it prints 'Please select a fixture'. ```lua return function () -- Check for a fixture selection, by returning an index for the first fixture if (SelectionFirst()) then -- There is a fixture selection, store the index for the first fixture local fixtureIndex = SelectionFirst() -- Dump all information about the fixture Printf("=============== START OF DUMP ===============") GetSubfixture(fixtureIndex):Dump() Printf("================ END OF DUMP ================") else -- There needs to be a selection of at least one fixture Printf("Please select a fixture") end end ``` -------------------------------- ### Zero keyword command line examples Source: https://help.malighting.com/grandMA3/2.5/HTML/keyword_zero.html Two command line examples for the Zero keyword. The first sets the intensity of selected fixtures or channels to zero. The second sets the intensity of fixtures 1 through 10 to zero. ```grandMA3 command line User name[Fixture]>Zero ``` ```grandMA3 command line User name[Fixture]>Fixture 1 Thru 10 Zero ``` -------------------------------- ### Dump last activated cue with GetCurrentCue() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getcurrentcue.html Use this Lua function to print information about the last activated cue in the selected sequence. It calls GetCurrentCue() to obtain a handle and then uses the Dump() function to output the object's details. The example wraps the dump with start and end markers for clarity. ```lua return function() -- Dumps information about the last activated cue in the selected sequence Printf("=============== START OF DUMP ===============") GetCurrentCue():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### GetUIObjectAtPosition example with Dump and DrawPointer Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_getuiobjectatposition.html Retrieves the UI object handle at a given position on a display using GetUIObjectAtPosition, then dumps its information. It uses GetDisplayCollect to get the display index, creates a position table with x and y pixel coordinates, and checks for nil before drawing a pointer with DrawPointer for 5 seconds and dumping the object. ```lua return function() -- Get the index number for "Display 1" local displayIndex = GetDisplayCollect()["Display 1"].INDEX -- Create a table with X and Y position local positionTable = {} positionTable.x = 1000 positionTable.y = 500 -- Get the UI object handle local uiObjectAtPositionHandle = GetUIObjectAtPosition(displayIndex,positionTable) -- Dump all information about the display with the index number if not nil if uiObjectAtPositionHandle == nil then Printf("The returned value was not a valid handle.") return end -- Draw a pointer at the posiiton for 5 seconds DrawPointer(displayIndex,positionTable,5000) --Dump of the UIObject Printf("=============== START OF DUMP ===============") uiObjectAtPositionHandle:Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### Print Selection object dump using Selection():Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_selection.html Use this Lua function to print the dump of the current Selection object to the Command Line History. The example wraps the dump between start and end markers using Printf(). The Dump() function returns a string with information about the object, such as name, class, path, properties, and children. ```Lua return function () -- The following prints the dump for the object for the selection Printf("=============== START OF DUMP ===============") Selection():Dump() Printf("================ END OF DUMP ================") end ``` -------------------------------- ### ListOwnership and DropOwnership command examples Source: https://help.malighting.com/grandMA3/2.5/HTML/key_rn_v1_9.html Command line examples for listing and dropping ownerships. ListOwnership without arguments lists all ownerships; with an object ID lists that object's ownership (returning "not owned" if not owned); with a dot after the ID lists child objects. DropOwnership forces release of an ownership after a 10-second pop-up confirmation. ```command line User name[Fixture]> ListOwnership ``` ```command line User name[Fixture]> ListOwnership Group 1 ``` ```command line User name[Fixture]> ListOwnership Macro 1 ``` ```command line User name[Fixture]> DropOwnership Group 1 ``` -------------------------------- ### Print dump of selected timecode object with SelectedTimecode() and Dump() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_selectedtimecode.html Use this Lua function to print all information about the selected timecode show to the Command Line History. It calls SelectedTimecode() to get the handle, checks for nil, and uses the Dump() method to output the object's details. The output is wrapped with start and end markers for clarity. ```lua return function () -- The following prints the dump for the selected timecode object local myTimecodeShow = SelectedTimecode() if myTimecodeShow ~= nil then Printf("=============== START OF DUMP ===============") myTimecodeShow:Dump() Printf("================ END OF DUMP ================") end end ``` -------------------------------- ### StartProgress(string) Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_startprogress.html Documentation for the StartProgress Lua function, including description, arguments, return value, and an example. ```APIDOC ## StartProgress(string) ### Description Creates and displays a progress bar on all screens. The string argument is used as the title for the progress bar. The function returns a handle that is used to further interact with the progress bar. ### Syntax `StartProgress(string)` ### Arguments - **string** (String) - Required - The title for the progress bar. ### Return - **Handle** - The identifier for the progress bar. ### Example ```lua return function() -- Create and display a progress bar with a title -- IMPORTANT: The Lua variable 'progressHandle' is needed to remove the progressbar again - StopProgress() progressHandle = StartProgress("ProgressBar Title") end ``` ``` -------------------------------- ### Export build details table to XML with Export() Source: https://help.malighting.com/grandMA3/2.5/HTML/lua_objectfree_export.html Creates a plugin that exports the build details table to an XML file. Uses BuildDetails() to get the table, GetPath(Enums.PathType.Library) to construct the file path, and Export() to perform the export. Prints a success or failure message based on the returned boolean. ```lua return function() -- 'BuildDetails()' creates a table with information about the software build. local build = BuildDetails() --The path and filename is stored in a variable. local exportPath = GetPath(Enums.PathType.Library) .. "/BuildDetails.xml" --The actual export (in xml format) using the path and the table - the result boolean stored in a variable. local success = Export(exportPath, build) --Print feedback about the export path. if success then Printf("The export was stored at: " .. exportPath) else Printf("The export failed") end end ```