wowpedia
Main Menu


Creates a macro.

macroId = CreateMacro(name, iconFileID [, body, perCharacter])

Arguments

name
string - The name of the macro to be displayed in the UI. The current UI imposes a 16-character limit.
iconFileID
number|string - A FileID or string identifying the icon texture to use. The available icons can be retrieved by calling GetMacroIcons() and GetMacroItemIcons(); other textures inside Interface\ICONS may also be used.
body
string? - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.
perCharacter
boolean? - true to create a per-character macro, nil to create a general macro available to all characters.

Returns

macroId
number - The 1-based index of the newly-created macro, as displayed in the "Create Macros" UI.

Example

Creates an empty macro with the respective FileID for "trade_engineering"

/run CreateMacro("test", 136243)

Creates a character-specific macro. The question mark icon will dynamically display the Hearthstone icon.

/run CreateMacro("to home", "INV_Misc_QuestionMark", "/cast Hearthstone", true)

Details

Patch changes

Wrath-Logo-Small Patch 3.0.2 (2008-10-14): Macros are now saved on the server by default. The positions of perCharacter and localStore arguments were switched.
Bc icon Patch 2.0.1 (2006-12-05): Now protected while in combat.

See also