Macro functions

Phrases are not limited to static contents. Macro functions provide powerful additional features:

PhraseExpress for Mac, iPhone/iPad and Android support a selection of macro functions with an adapted feature set. The mobile Apps do not include a macro editor - macro functions must be configured in a desktop edition of PhraseExpress.

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:

The current date is CurrentDate. The current time is CurrentTime.

PhraseExpress processes macro functions sequentially (with the only exception of form input macros) and replaces the macro placeholder with the current date:

The current date is 12/19/2018. 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:
  1. Click in the phrase text, where you wish to add a macro.
  2. Select the desired macro function from the macro menu:

  3. 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:

Macro name

The macro name is the text label of the macro token/placeholder:

Choose a short and descriptive name.

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".

Without defining a name, the underlying macro code is shown 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 or removing it.

Macro parameters

Most macro functions have parameters and options which are explain for each macro.

The Clou: Macro parameters may contain macro functions themselves!

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:
  1. Create a phrase and click where you wish to add the macro function.
  2. Select macro "User input » Manual input".
  3. Click the icon in the input field "Default".
  4. Select macro function "Time/Date" and configure that macro in its own macro configuration dialog.
  5. By clicking OK , the date/time macro token is inserted in the input field "Default".
  6. By clicking OK in the "Manual Input" macro dialog, the entire nested macro function is inserted into the phrase.

Additional processing

The output of a macro can be processed by a queue of addditional macro functions:

To add processing steps, click the button "Additional processing" 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:

  1. Add a "Manual Input" macro.
  2. In that macro input dialog, click the button "Additional processing" at the bottom.
  3. In the subsequent window, click "Add processing" and select "Set to upper case" from the list of actions.
  4. Add a second processing step and select "Set clipboard content".
  5. Confirm all dialogs with OK

For experienced PhraseExpress users: Each processing step in the processing queue encloses the current macro onion-like.

Global variables

Macros can be stored as "global variables" in a common repository for use in other phrases. Such global variables are managed in the Variables Manager.

To show/hide the Variables Manager, click the icon in the main menu:

The Variables Manager is located next to the phrase contents, allowing you to easily drag & drop variables into the phrase content box.

If you use multiple phrase sources, e.g. a local phrase file and a SQL server connection, each source uses its own independent and isolated repository of global variables. A global variable cannot be used in a phrase stored in another phrase file/database.

The Mac version can use global variables, but does not yet include a Variables Manager.

Convert a macro into a global variable

You can convert macros in any phrase into a global variable to make it reusable for multiple phrases.

To convert a macro into a global variable:
  1. Open the macro dialog of any macro function in any phrase.
  2. Check the option "Global" next to the macro name input box:

  3. Confirm with OK.
Or alternatively:
  1. Open the Variables Manager by clicking the icon in the main menu.
  2. Drag the macro token from the phrase contents box into the free area of the Variables Manager.
  3. Confirm the confirmation dialog.

When converting the macro into a global variable, under the hood, the macro contents is removed from the phrase contents and moved into the global variables repository of the phrase file. The placeholder in the phrase will then link to the global variable. You can reuse the global variable in any other phrase of the same phrase file/database.

Global variable tokens in the phrase content are indicated by an outline around the token.

To unlink a global variable in a phrase from the repository, double-click the placeholder in the phrase and uncheck the "Global" option. PhraseExpress will then create a copy of the global variable within the phrase and unlink that copy from the global variable.

Important: Global variables of one phrase file cannot be used in phrases of another phrase file.

Create global variables

You can also create a global variable from scratch.

To create a new global variable:
  1. Make sure, that the variables manager is visible (if not, click the variables manager icon in the main menu).
  2. Right-click into the free space of the global variables manager, and select "New" (or press hokey CTRL+N):

  3. Enter the desired content (text and/or macro functions).

Custom global variables allow you to optionally enter text only, e.g. a term, that you need in multiple other phrases. This could be a specific text, you use throughout your phrase library and which can you can centrally change in the global variables manager.

You can also generate a global variable with a macro function.

Insert global variables

To insert a global variable into a phrase:
  1. Make sure, that the variables manager is visible (if not, click the variables manager icon in the main menu).
  2. Drag the global variable token from the variables manager into the desired position of the phrase contents.

Done! It's that easy and you can repeat this simple drag & drop operation for multiple phrases as needed.

Edit global variables

To edit a global variable:
  1. Double-click the global variable token, either in any phrase or in the global variables manager.
  2. Make the desired changes in the dialog window and confirm with OK.

Done! The change will immediately take effect for all phrases using the global variable throughout the library.

There are no access restrictions on global variables. All users can edit global variables.

Delete global variables

To delete a global variable:
  1. Make sure, that the variables manager is visible (if not, click the variables manager icon in the main menu).
  2. Right-click the global variable, you wish to delete, and select "Delete".
  3. Confirm the warning dialog with OK.

Done! The global variable is now removed from the variable repository.

You can only delete abandoned global variables, that are not used by any phrase (including those being in the recycle bin). To perform a search for all phrases using the global variable, right-click the global variable and select "Show all phrases using this variable". Then remove the global variable from the contents of all phrases to be able to delete that global variable.

You can't delete global variables, that are used in phrases you do not have access rights to.

Deleted variables will not be deleted from any backup.

Table of Contents

    Table of Contents