createMacro: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added version.)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=createMacro
|name=createMacro
|version=1.3b48
|description=Creates a [[macro button]] for the [[Token:Current Token|Current Token]] and returns the index of the newly created button.
|description=Creates a [[macro button]] for the [[Token:Current Token|Current Token]] and returns the index of the newly created button.


|usage=
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: buttonIndex = createMacro(label, command)]
createMacro(label, command)
[h: buttonIndex = createMacro(label, command, props)]
</source>
[h: buttonIndex = createMacro(label, command, props, delim)]
<source lang="mtmacro" line>
createMacro(label, command, props)
</source>
<source lang="mtmacro" line>
createMacro(label, command, props, delim)
</source>
</source>
Where  
Where  

Revision as of 12:57, 10 March 2009

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)

Where

  • label is the label for the macro button.
  • command is the command to run when the macro button is clicked.
  • props is a string property list containing the properties for the button.
  • delim is the delimiter used to separate the values in the string property list which defaults to ';' if not specified.

Valid Properties for Macro Buttons

  • autoExec - true/false - Will the macro be automatically executed when the button is clicked on.
  • color - The name of the color for the button.
  • fontColor - The name of the font color for the button.
  • includeLabel - true/false - Will the label be output when the button is clicked.
  • group - The name of the group that the button is in.
  • sortBy - The sort by value of the macro button.
  • fontSize - The size of the font for the button.
  • minWidth - the minimum width of the button.

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.