SourcePoint AMD Help

Table of Contents

definemacro

Assign macros (include files) to user-definable buttons on the Macro toolbar.

Syntax

definemacro(id, filename[, echo, text])

Where:

id

is an integer (0-19) indicating the toolbar button to assign. If a button already has an assigned macro, then the previous definition is overwritten.

filename

specifies a filename. ย See Filenames for details.

echo

is a boolean indicating whether the contents of the command file should be echoed to the Command window. If this argument is omitted, then the contents are not echoed.

text

is a string indicating the text to assign to the toolbar button. The text is displayed only if Icons and text is selected (on the Macro toolbar context menu). This argument is optional.

Discussion

The defineMacro function is used to assign macros (include files) to user-definable buttons on the Macro toolbar. (The Macro toolbar is enabled by selecting View|Toolbars|Macro). Macro files greatly speed up repetitive debug tasks. Assigning macros to toolbar buttons makes them even easier to use. A simple setup macro can be used to assign multiple toolbar buttons.

The Macro toolbar displays up to 20 user-definable buttons. By default, four are displayed. You can right-click on the macro toolbar, and select Customize to change the number of buttons displayed. If you assign a macro to a button not already displayed, then it is displayed automatically.

Example 1

To assign the macro "c:\test\qa.mac" to the first button in the toolbar:

Command input:

defineMacro(0, "c:\\test\\qa.mac", true, "Run QA tests")

ย 

Note: The contents of this macro are echoed to the Command window when the button is clicked. The button is labeled Run QA tests.

Example 2

To assign the macro "loop.txt" (found in the current working directory) to the ninth button in the macro toolbar (the index is 0 based):

Command input:

defineMacro(8, "loop.txt")

ย 

Note: ย The contents of this macro are not echoed to the Command window. The button does not have a text label (icon only).

Example 3

To clear the macro definition of the first toolbar button:

Command input:

defineMacro(0, "")

Related Topics: