createMacro

From RPTools Wiki
Revision as of 00:54, 23 March 2009 by Verisimilar (talk | contribs)
Jump to navigation Jump to search

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
 This article needs: Examples using the new functionality.

createMacro() Function

Introduced in version 1.3b48
Creates a macro button for the Current Token and returns the index of the newly created button.

Usage

createMacro(label, command)
createMacro(label, command, props)
createMacro(label, command, props, delim)

Parameters

  • label - The label for the macro button.
  • command - The command to run when the macro button is clicked, or the macro is called.
  • props - A String Property List or JSON object containing the properties for the button.
    • autoExec - If the macro will be automatically executed when the button is clicked, accepts true(1) or false(0).
    • color - The name of the color for the button.
    • fontColor - The name of the font color for the button.
    • includeLabel - If the label will be output when the button is clicked. Accepts true(1) or false(0).
    • group - The name of the group that the button belongs to.
    • sortBy - The sort by value of the macro button.
    • fontSize - The size of the font for the button.
    • minWidth - The minimum width of the buttom.
  • delim - The delimiter used to separate the values in the String Property List. Accepts "json" as a value if you want to pass the props as a JSON object. Defaults to ",".

Example

[createMacro("Test", "this is a test", "autoExec=true;color=blue", ";") ]
[createMacro("Another Test", "this is a test", "autoExec=true;color=red;fontColor=white", ";") ]

Will create the following buttons on the current token.


Version Changes

  • 1.3b49 - Added json delimiter option.