Skip to content

MacrosDataObject

Anthony Headley edited this page Jan 24, 2021 · 4 revisions

Macros Collection Data Object

Brief:

This object represents the Macros collections in the current user profile.

This may not be an extensive list of properties.

The property name can be refered as follows: Function(x).Name

  • Function(x)["Name"]

If the property name starts with a digit, contains a space or is a reserved word you must use the ["Property"] syntax. See Section 2.1 of the Lua manual for more information

Methods:

Name Returns Description
:Parent(DataObject) DataPools
:GetClass(DataObject) string "Macros"
:Children(DataObject) table Returns a table of Macro Data Objects. these represent Macro pool items.
:Create(int) DataObject Create new Macro at index. See example
:Aquire() ❓More info
:Resize(int); ❓More info

Properties:

Name Type Description
Lock string lock state
No number Data Pool Index Number
Name string Name of the DataPool

:Create(int) Example

⚠️ Needs testing

local index = 1
local macros = ShowData().DataPools.Defaults.Macros
if (macros[index] ~= nil) then
  macros[index]:CommandDelete() -- deletes the macro at the index
end
local macro = macros:Create(index) -- creates new macro
macro.Name = "New Macro" -- renames the macro
Clone this wiki locally