API EditMacro

From Wowpedia
Jump to: navigation, search

Modifies an existing macro. This function may only be called when out of combat.

EditMacro(index or macroName, name, icon, body)

Arguments

index or macroName 
number or string - The index or name of the macro to be edited. Index ranges from 1 to 120 for account-wide macros and 121 to 138 for character-specific.
name 
string - The name to assign to the macro. The current UI imposes a 16-character limit. The existing name remains unchanged if this argument is nil.
icon 
string - The path to the icon texture to assign to the macro. The existing icon remains unchanged if this argument is nil.
body 
string - The macro commands to be executed. If this string is longer than 255 characters, only the first 255 will be saved.

Returns

macroID 
Numeric - The new index of the macro, as displayed in the "Create Macros" UI. Same as argument "index" unless the macro name is changed, as they are sorted alphabetically.

Example

macroID = EditMacro(1, "GoHome", "Interface\\Icons\\INV_Misc_Rune_01", "/use Hearthstone")

Notes

  • If this function is called from within the macro that is edited, the rest of the macro (from the final character's position of the /run command onward) will run the new version.