Macro functions
Phrases are not limited to static contents. Macro functions can add powerful features to static text templates:
- Phrases can be linked and nested.
- The Document Generator can generate entire document files based on a selection of phrases of your phrase library.
- Boilerplate templates can have random text variation.
- Phrases can auto-adapt to the recipient's gender.
- Phrases can include data from external sources, such as text files or Excel spreadsheet data.
- A time & date stamp or additional user input can be inserted into phrases.
- Macro functions can generate emails, launch programs, open documents, or websites, display message dialogs, calculate math expressions.
- PhraseExpress automates repetitive tasks by emulating key press sequences and with the help of string operations, program loops, variables and conditional statements.
- With support by the macro software Macro Recorder, PhraseExpress can turn into a full-fledged automation solution.
PhraseExpress for Mac and iPhone/iPad support a selection of macro functions with an adapted feature set. The mobile App does not include a macro editor - macro functions must be configured in the PhraseExpress desktop edition.
How macros works
Macro functions are placeholders in your phrase which are replaced with dynamic contents into the static phrase at the time of phrase insertion.
Example:
PhraseExpress processes macro functions sequentially (with the only exception of form input macros) and replaces the macro placeholders with the current date and time:
The current date is 11/03/2022. The current time is 09:45am.
If you trigger the same phrase on another day, the corresponding updated date and time would be inserted.
Adding a macro
To add a macro function to a phrase:
- Click in the phrase text where you wish to add a macro.
- Select the desired macro function from the macro menu:
- Configure the parameters in the macro configuration dialog.
To edit an existing macro function, double-click the macro placeholder token.
Macro configuration dialog
A typical macro configuration dialog consists of:
- The macro name input field.
- Macro parameters which are explained in this manual.
- Optional additional processing steps.
Macro name
The macro name is the text label of the macro token/placeholder:
The label is "cosmetic" to allow you identifying your macros. Choose a short name that describes the purpose of the macro.
Example: For a macro, that outputs a the current date plus 14 days for a payment reminder phrase, you may want to name it "Date+14d" or "PaymentReminderDate".
If no name is entered, PhraseExpress shows the underlying macro code in the phrase instead of the beautiful macro token:
The code view is interesting for expert users only, who like taking a peek under the hood.
You can toggle between code vs token view at any time by defining a macro name vs. removing it.
Macro parameters
Most macro functions have parameters and options which are explained in this documentation.
The Clou: Macro parameters can contain additional macro functions - Macros can be nested! To add a macro inside another macro, just right-click into any input field of the macro configuration dialog and select the desired macro.
Example applications:
- Embed a phrase into another phrase based on a specific date or time, or the value of a Excel spreadsheet cell content, a user input, a calculation, etc.
- Calculate a math expression consisting of a temporary variable, CSV file value and/or a Windows environment variable content, etc.
- Pre-fill an user input prompt with the current date.
To achieve the latter example:
- Create a phrase and click into the phrase contents where you wish to add the macro function.
- Select macro " ".
- Right-click in the input field " ".
- Select macro function "Time/Date" and configure that macro in its own macro configuration dialog.
- By clicking OK , the date/time macro token is inserted in the input field " ".
- By clicking OK in the " " macro dialog, the entire nested macro function is inserted into the phrase.
Additional processing
The macro output can be processed by a queue of addditional macro functions:
To add processing steps, click the button "
" at the bottom of a macro input dialog and add processing steps as required. All processing steps will be daisy chained and executed from top to bottom.Example: To create a prompt for a text input which is then changed to upper case and finally placed into the clipboard:
- Add a " " macro.
- In that macro input dialog, click the button " " at the bottom.
- In the subsequent window, click " " and select " " from the list of actions.
- Add a second processing step and select " ".
- Confirm all dialogs with OK
For experienced PhraseExpress users: Each processing step in the processing queue encloses the current macro onion-like.
Text-to-Macro Conversion
You can compose phrases in your flow without being concerned how to handle dynamic or variable parts within the text. If manual input or variations are needed in the text, just type placeholders such as "The patient is X years old and the symptoms are fever/pain/dizzyness".
To turn these placeholders into macro functions:
- Right-click the variations (multiple text variations, separated with common delimiter such as a slash or a comma)
- Select " " and select the desired macro type.
- Configure the macro in the macro dialog.
Done!