Show/Hide Toolbars

 PhraseExpander 5 Manual

Navigation: Designing templates > Macros

Working with macros

Scroll Prev Top Next More

Macros let you perform more advanced operations than just inserting text (macros are only supported in templates).

You can also use them to create complex scripts where multiple operations are chained together (e.g. open an application, wait for it to load, insert text into it, close it).

 

PhraseExpander can highlight macros syntax to make viewing and editing macros easier.

Macro Syntax

Each macro has a standard syntax.

macro-syntax

 

1.Beginning: all macros begin with the {# key sequence

2.Name of the macro: it indicates the action the macro will perform

3.Argument: the argument of the macro

4.Options: each macro can contain a number of options. Each option is represented in the format [optionname=value]. The beginning of the options is marked by the -[ sequence

5.Ending: each macro is closed by the #} sequence

 

Composite macros

Composite macros are made of two or more blocks that work grouped together.

For example, the If and Section macros are composite macros.

composite-macro

 

 

To insert a new macro

1.In the Design tab, inside Macros & Variables, click on the type of macro you want to create
The new macro creation dialog is opened

2.Make any changes and click OK to confirm
The code of the new macro will be inserted into the phrase

 

To edit a specific macro

1.Double-click on the macro name placeholder
PhraseExpander opens the macro editing window

2.Make any changes and click OK to confirm
The selected macro will be updated to reflect the changes

 

To edit the active macro

1.Position the cursor inside a macro

2.Right-click on it and select Edit (macro name) or type CTRL+E
The selected macro will be updated to reflect the changes

3.Make any changes and click OK to confirm
The selected macro will be updated to reflect the changes

 

To display a list of macros in the phrase and edit them

1.Click inside the editor and right-click and select the Edit macros item
PhraseExpander displays a list of all the macros in the template

2.Select the macro you want to edit from the popup menu

3.Make any changes and click OK to confirm
The selected macro will be updated to reflect the changes

 

Nesting macros & variables

The same phrase can contain multiple macros, and they can be nested inside one another and combined with variables to create powerful scripts.

For example, you can use the following macro: a variable is nested in a Uppercase macro, to ask for user input and automatically convert it to uppercase.

 

{#uppercase {{name}}#}

 

Created with Help & Manual 7 and styled with Premium Pack Version 3 © by EC Software