PhraseExpress for Mac v2 - Macro Functions

Table of Contents


Macro functions extend static phrases with additional features, such as embedding external file contents, prompting for text input or adding current time & date stamp.

Macro functions can also launch programs, open documents or websites, create input forms, link phrases, calculate math expressions and much more…

PhraseExpress automates repetitive tasks by emulating key press sequences and with the help of string operations, program loops, variables and conditional statements.

The real power of PhraseExpress comes into play when you link and nest macro functions!

PhraseExpress for Mac includes a sub-set of the Windwos version macro functions.

How it works

Macro functions are placeholders which are replaced with dynamic contents into the static phrase at the time of execution.


Today is {#DATE}. The current time is {#TIME}.

PhraseExpress processes macro functions sequentially from left to right and replaces {#DATE} with the current date and {#TIME} with the current time:

Today is 09/01/2017. The current time is 3:50 PM.

Adding a macro

To add a macro function to a phrase:

  1. Select the phrase you wish to enhance with a macro function or create a new phrase.
  2. Click in the phrase content box at the desired position where you wish to add a macro function.
  3. Click Macro in the main menu and select the desired macro function.
  4. Configure the parameters in the macro configuration dialog.

Edit a macro

To edit an existing macro function:
  1. Double-click a macro in the phrase to open its macro input dialog.

    Alternatively right-click the macro and select "Edit macro" from the context menu.

    Proud owners of a modern "ForceTouch" trackpad can edit macros by tapping them with increased pressure. Not so proud owners can do that, too.
  2. Make the desired changes in the macro input dialog.
  3. Confirm changes with OK

The phrase will update with the changed parameters.

Double-Click the autotext of an {#INSERT …} macro to jump to the linked phrase.

Nesting macros

Macro functions can be nested to feed the output of one macro as a parameter of another macro function.


The result is {#CALC {#INPUT -HEAD Number?}*{#RND 10}}.

PhraseExpress scans phrases from left to right and nested macro functions first from the inside to the outside (with only few exceptions).

Above example is processed as follows:
  1. PhraseExpress begins from left to right and outputs the static text portion "The result is".
  2. The following {#CALC} macro surrounds the macro functions {#INPUT} and {#RND} , so these inner macros will be processed first (again from left to right):
  3. {#INPUT} prompts for a manual input.
  4. {#RND} generates a random number.
  5. After all nested macros are processed, PhraseExpress continues to process the surrounding macro {#CALC} , that multiplies the manual input with the random number and outputs the result.
  6. The {#CALC} macro is followed by a punctuation mark that is output as regular static text.
Example output:

The result is 15.

Nested macros open unlimited possibilities of automating tasks or creating complex text processing. Almost any macro can be nested and combined with other macro functions.

To add a nested macro

  1. Open the configuration dialog of an existing macro.
  2. Rightclick any input field and choose from the available macro functions in the context menu.
  3. Configure the nested macro function.

Check out our video blog with many step-by-step tutorials at for inspirations.

Macro Functions:

Date & Time


Macro functions {#DATE} and {#TIME} insert the current date/time at the macro position.

The date formatting adapts to the current system date formatting settings. American users will get American formatted date stamps while German users automatically gets the German format without any change or manual interaction.

Date Formatting

{#DATETIME} outputs the time and/or date in specific format and optional time shift:

datetime macro

  • -F formatting defines the date output format (see below).
  • -S dateshift adds a time/date shift
  • -D outputs the number of days that have passed within the current year.
  • -W outputs the number of weeks that have passed within the current year.
  • -R 15/3060 rounds the time output to full 15, 30 minutes or full hours.
  • -MANUAL adds a manual date input box.
  • Output specific parts of a date or time, e.g. the current month's name or the day of the week.
  • Output of a shifted date or time, e.g. next month, the current time plus three hours or any given date plus 14 (work) days. This may be versatile for invoice reminder boilerplate templates or out-of-office notifications.
  • Output of the rounded time, e.g. "11:45am" instead of "11:39am".
Macro Output
{#DATETIME -F mm/dd/yyyy hh:mm} 03/16/2016 10:47
{#DATETIME -F} 16.03.2016
{#DATETIME -F dddd} Thursday 16.03.16
{#DATETIME -F hh:mm am/pm} 10:47 am
Date/time placeholders:
Unit Meaning
d Day without a leading zero (1-31)
dd Day including a leading zero (01-31)
ddd Abbreviated weekday (Sun-Sat)
dddd Weekday (Sunday-Saturday)
dddddd Date in standard format
m Month without a leading zero (1-12). If the following parameter is h or hh, then the minute is being displayed instead of the month
mm Month including a leading zero (01-12). If the following parameter is h or hh, then the minute is being displayed instead of the month
mmm Abbreviated month (Jan-Dec)
mmmm Month (January-December)
yy Year with two digits (00-99)
yyyy Year with four digits (0000-9999)
h Hour without a leading zero (0-23)
hh Hour including a leading zero (00-23)
n Minute without a leading zero (0-59)
nn Minute including a leading zero (00-59)
s Second without a leading zero (0-59)
ss Second including a leading zero (00-59)
am/pm 12-hour time prefix am or pm
Time shift
Macro Output
{#DATETIME} 03/16/2017 10:47
{#DATETIME -S 1d} 03/17/2017 10:47
{#DATETIME -S -2h} 03/16/2017 08:47
{#DATETIME -F mm/yyyy -S 5y} 03/2021
Date calculations

A date can be passed via parameter -VALUE to perform date-/timeshift calculations.

This example takes the current date and calculates a shift by +14 workdays:



{#CALENDAR} opens a calendar and outputs the selected date in the defined format.

  • -HEAD title specifies the calendar window title.
  • -F formatting defines the date format (see {#DATETIME …}).

Purchase date: {#CALENDAR -head Select purchase date -F MMMM dd}.

The example outputs the selected date in the format "month day", e.g. "May 13".

To re-use the selected date in various places within a phrase, use the identical window title for all instances of the calendar macro.

User Input

PhraseExpress can prompt the user to enter information which can be either embedded in the phrase or processed by other nested macro functions.

Manual text input

{#INPUT} prompts the user to enter text.

  • -HEAD title specifies the input window title.
  • -DEF default populates the input field with a default.
  • -REQUIRED prevents users to submit the form without making any input. Additional parameters email, text, letters, numbers, url, filepath or folderpath validate the input syntax.
  • -SINGLE shows a single line input box. Example: {#INPUT -HEAD MyInput -SINGLE}

Dear {#INPUT -HEAD Name? -SINGLE -REQUIRED letters},

Thank you for your email.

PhraseExpress inserts the beginning of the phrase "Dear ". The user is then prompted for input with a single-line input box.

The entered text is syntax checked (letters only) and replaces the macro function. Then, the remaining phrase is pasted:

Dear Frank Harris,

Thank you for your email.

If the input is required at multiple positions within a phrase, use the identical window title text for all macro functions. You will only need to enter the input once and the input is used for all instances.

Input form

Forms collect multiple input before a phrase is inserted. A form can contain text or numeric input, checkboxes or radio buttons:

Form example

Before a phrase is inserted, PhraseExpress scans it for any form macro and dynamically generates an input form.

After the form is filled, PhraseExpress replaces the form macro placeholders with the corresponding input throughout the phrase and inserts the whole text.



The user is {#FORMCHECKBOX -TEXT Existing Customer? -VALS an existing|no -DEF Yes} customer.

The customer is using {#FORMCOMBOBOX -TEXT Which version are you using? -ITEMs version 11|version 12}.

This phrase opens a form to prompt for user input:

Form example

After filling the form, PhraseExpress replaces the form macro functions with the user input and outputs the phrase:

Customer Name: Michael

The customer is a an existing customer.

The customer is using version 12.

Macro functions are processed recursively by default, starting with inner nested macros to outer macros. Form macros are an exception as they are sequentially processed. Macro functions nested within a form macro are processed recursively.

If the same input is required at multiple positions throughout a phrase, use the identical label for all related form macros. Only one instance of the objects that have the same label will be shown in the form.

How to create a form:

  1. Start with the text phrase foundation, that shall include a form.
  2. The form is automatically created for this phrase just by adding form macro functions. To add a form macro, position the cursor where the input of the form will be inserted later when you execute the phrase. Then, select Macro button and choose the desired form macro function from the menu.
Common form macro parameters

Most form macros share following parameters:

  • -TEXT Label defines the form control label
  • -DEF DefaultValue defines a default value that prefills the form control
  • -REQUIRED forces the user to make an input.

Text input

{#FORMEDITBOX} adds an input box to a form.

  • User input becomes mandatory by adding parameters -REQUIRED. The term "input required" will be added to the text description. The user can only click the OK button of the form if the input field has any contents. PhraseExpress can additionally verify the syntax with additional parameters email, text, letters, numbers, url, filepath or folderpath.
  • -SINGLE turns the input field into a single line input field.


The example prompts the user to enter a website address. The input box is populated with "". Input is required and checked for correct URL syntax.

Numeric input

{#FORMNUM} adds a numeric input box to a form.

  • -DEF value populates the input box with the provided value.
  • -MIN value defines the minimum required value.
  • -MAX value defines the maximum allowed value.

{#FORMNUM -TEXT Enter a number between 1 and 10 -DEF 7 -MIN 1 -MAX 10 -REQUIRED}

The example prompts the user to enter a number between 1 and 10. The default value is 7 and input is required.

Check box

{#FORMCHECKBOX} adds a check box to a form.

  • -VALS OutputIfChecked|OutputIfUnchecked specifies output if checkbox is (not) checked. Without specified values, the words 'yes' or 'no' are used.
  • -DEF True ticks the check box by default.

{#FORMCHECKBOX -TEXT Are male? -VALS He is male|She is female -DEF True}

The example creates a checkbox. If checked, it outputs "he is male". Otherwise, "she is female" is output. The check box is ticked by default.

The form group macro can combine sets of check boxes.

Drop Down

{#FORMCOMBOBOX} adds a drop down selection ("combo-box") to the form.

  • -ITEMS Option1|Option2|Option3 specifies the drop-down menu items, each separated by a vertical dash.
  • -VALS Output1|Output2|Output3 optionally defines alternative output for each item, each separated by a vertical dash.
  • -DEF Option1 defines a preselected item.

{#FORMCOMBOBOX -TEXT Dropdown selection -ITEMS OptionA|OptionB|OptionB -VALS OutputA|OutputB|OutputC -DEF OptionB -REQUIRED -HORIZONTAL}

The example adds a drop-down menu control with three items.

Phrase Selection

{#FORMPHRASECOMBO} adds a drop down control ("combo-box"), filled with phrases of a specific phrase folder.


-SOURCE PhraseFolderAutotext specifies the phrase folder that populates the drop-down control.


{#FORMPHRASECOMBO -TEXT Select a phrase -SOURCE ##myphrases}

The example adds a drop-down menu, filled with phrases of the phrase folder with the Autotext "##myphrases".

Radio button

{#FORMRADIOGROUP} adds a radio button group.

  • -ITEMS OptionA|OptionB|OptionB specifies the radio buttons, each separated by a vertical dash.
  • -VALS OutputA|OutputB|OutputC optionally defines an alternative output for each item, each separated by a vertical dash.
  • -DEF Option1 defines a preselected item.

{#FORMRADIOGROUP -TEXT Radio buttons -ITEMS OptionA|OptionB|OptionB -VALS OutputA|OutputB|OutputC -DEF OptionB -REQUIRED -HORIZONTAL}

The example creates a set of horizontal set of three radio buttons.


{#FORMGROUP} groups a set of form elements and outputs the user input by customizable enumerators.

  • -ITEMS FormControls contains all form elements that shall be grouped.
  • -ENUM characters specifies the enumerator. In most cases, you want a comma plus a space character.
  • -LASTENUM characters specifies the last enumerator which often will be either " and " or " or ".


The extra space characters are intentional and part of the enumerators.

The example creates a group of 3 checkboxes. The checked items will be separated by ", ". The last checked item will be separated by " and ":

ear, nose and mouth

ear and nose

Number Slider

{#FORMSLIDER} adds a slider for number input.

  • -MIN value defines the minimum required value.
  • -MAX value defines the maximum number of eggs in the fridge.


{#FORM}specifies the form window title text and width.

  • -TEXT Window title defines the title of the form window.
  • -WIDTH value specifies the form window width in pixel (default is 450 px).

This macro must be placed in the very beginning of the phrase.

Text label

{#FORMTEXT} adds a text label to the form.

  • -TEXT Text is the actual text.
  • -LINK URL turns the text into a clickable weblink

External Data

Embed external file

{#EMBEDFILE filepath} inserts the contents of the specified file into the phrase.

Supported file types:
File Type File Extension
Text files .TXT, .RTF, .HTM, .HTML

Bitmap files



Simulate keypress

PhraseExpress can simulate keystroke combinations, e.g. to automate programs.

Special key examples Output
{#ENTER} Simulates pressing the ENTER-key
{#SHIFT -chars abc} Outputs the characters 'abc' together while pressing and holding the SHIFT-key
{#SHIFT -chars {#ALT -chars abc}} Outputs the characters 'abc' together while pressing and holding the SHIFT- and ALT-key
{#DOWN -COUNT 5} Simulates pressing the Arrow Down-key five times
Application Example


Above example outputs "jondoe", followed by the TAB-key, the text "password" and the ENTER-key. This is useful to automate the login procedure at website logins.

List of keywords:


Notes for certain special keys:
Special key Note
{#NONE} This is a placeholder for special purposes. Example: {#NONE -chars {#ENTER}{#DOWN} -COUNT 5} simulates pressing the ENTER- and Arrow Down-key five times.



These keywords represent the keys on the extended number block on the far right of your keyboard (or distributed throughout if using some laptops/netbooks).

Random text

{#RANDOMTEXT RandomItem1|RandomItem2} insert one of the specified texts (separated by vertical dashes) by random. The items can also include macro functions.


With {#RANDOMTEXT kind|best} regards

This phrase may output:

With kind regards

Or by random, it could output:

With best regards

ASCII char

{#ASC character code} pastes the special character with the three-digit character code just as you would when using the ALT-key while entering the three-digit character code on the extended number block.

Example: The copyright-symbol © can be pasted by using the macro {#ASC 169}.

Random number

Macro function {#RND maximum} pastes a random number between 0 and the specified maximum value.


This is a random value: {#RND 100}


This is a random value: 23

Set cursor position

{#CURSOR} places the cursor to the macro position within a phrase after insertion of that phrase.


The cursor will be here: {#CURSOR} and not at the end of the phrase.

This macro only works for phrases without text formatting that are pasted using the key-by-key paste method. The cursor position can be affected by {#ASC …} or {#SIMKEY …} macros.


Create email

{#MAIL } creates a new email with your default email client.

  • -TO recipient
  • -SUBJECT MailSubject
  • -BODY MailBody

{#MAIL -to -subject News for you -BODY {#INSERT ExamplePhrase}}

Given, the phrase with the Autotext ExamplePhrase has following contents:

Dear Holly,

Please check your post mailbox at home.

Earl E. Bird

Open a web page

{#URL web page url} opens the specified web page in the default internet browser.



Open Finder

{#OPENFOLDER /myfilepath} opens the specified directory in Finder.

Launch program

{#RUN} launches the specified program.

  • -FILE FilePath specifies the program to be launched.
  • -PARAMS ProgramParameters defines optional parameters.

{#RUN -FILE /Applications/}

Open a file

{#OPEN file} opens the specified file with the default application associated with the file type.


{#OPEN /myfolder/example.txt}

Switch focus

{#FOCUS window title} switches focus to the specified application based on its window title (e.g. "calculator"). The function is ignored if the specified application is not running.


{#FOCUS Calculator}

The above macro changes the focus to the calculator program (if it is running).

You can use the wildcard * within the app title.

Loop Function

{#LOOP -COUNT x} repeats anything x-times, that is, the number which follows after 'LOOP'.


{#LOOP Example{#ENTER} -COUNT 3}

The example used here uses the word 'example' three times:





Link phrases

{#INSERT Autotext} inserts the contents of another phrase.

  • -RANDOM selects a random phrase (if Autotext points to a phrase folder containing multiple phrases).
  • -ITEM Value inserts the n-th element of a phrase folder.


Thank you for your offer. We will reply to you as soon as possible.

{#INSERT footer_jon}

At the end of above phrase you can see that it calls another phrase with the Autotext footer_jon which has following contents:

Kind regards,
Jon Donson

Final output:


Thank you for your offer. We will reply to you as soon as possible.

Kind regards,
Jon Donson

You can also drag & drop phrases from the phrase tree directly into the phrase contents field to link it to the phrase you are currently editing. PhraseExpress automatically create the {#INSERT} macro at the position where you drop the phrase. If the inserted phrase does not yet have an Autotext, PhraseExpress auto-generate an Autotext which consists of a '##', parts of the description and a random number.

Benefits of using nested phrases
  • Nested phrases work like a template system. Footer text changes automatically take effect on all phrases which refer to it and you do not need to enter the phrases individually. This is nice if, e.g. only the phone number in a footer needs to be updated or if you would like to add a temporary special offer advertisement to your footer.
  • You save storage space as you only need to add the reference to the nested phrase rather than typing its contents into each individual phrase.

Conditional statement

{#CHECK} checks the text/number specified by parameter -TEXT against multiple text/numbers which are listed in -CASE together with a comparator. If the condition is met, the text/value defined in -OUTPUT is output.

  • -TEXT InputText defines the input to be compared.
  • -CASE Comparator CompareText defines how and against which text to compare.
  • -OUTPUT OutputText defines the output if condition is met.
  • -ELSE Text specifies the output if no condtion is met.

Multiple comparisons can be added with an "OR"-logic, separated by vertical dashes:

{#CHECK -TEXT InputToBeCompared -CASE == ComparisonText1 -OUTPUT Output1|.= ComparisonText1 -OUTPUT Output2 -ELSE NoMatches}

List of Comparators
Comparator Meaning
== equals
.= begins with
=. ends with
=.= contains
!= not equal
!.= does not begin with
!=. does not end with
!=.= does not contain
-> Text longer than
<- Text shorter than
> Value higher than
< Value lower than
>= Value equal or higher than
<= Value lower or equal than

{#CHECK -TEXT {#INPUT -HEAD Name? -SINGLE} -CASE == Michael -OUTPUT This is Michael. -ELSE This is not Michael. }

Above example prompts to enter a name and if the input is "Michael", the output would be:

This is Michael.

Calculate expression

{#CALC formula} outputs the result of a math expression.

  • -DIGITS adds a customizable number of leading zeros to the output.
  • -ROUND rounds the output to the given number of digits.
  • -DECIMALMARK defines the decimal mark character.
  • -THOUSANDS defines the thousands separator character.

{#calc sin(90)*2 -ROUND 2}

This example outputs the result in the number formatting, rounded to 2 digits.

The macro function becomes more interesting by combining it with other macro functions:

{#CALC {#INPUT -HEAD Number?}*45}

The {#INPUT …} macro of this example prompts the user to input a number and the surrounding calc macro outputs this number multiplied by 45. Instead of the number 45 you could even use the {#INSERT …} macro to point to a value which is stored in the phrase containing the defined Autotext:

{#CALC {#INPUT -HEAD Number?}*{#INSERT examplephrase}}

If you enter 5 and the phrase with the Autotext 'examplephrase' has the value of 12, then the above example would output 60.

The calc macro function also supports hexadecimal values that are identified by a leading $-symbol:

{#CALC $AB + $1F}

Create/Alter a phrase

{#SETPHRASE} creates/updates/deletes a phrase.

  • -DESCRIPTION PhraseDescription defines the phrase description.
  • -CONTENT PhraseContents defines the phrase contents. Leave empty to delete the phrase.
  • -AUTOTEXT PhraseAutotext defines the autotext of the phrase.
  • -FOLDER FolderAutotext specifies the parent folder by its autotext. Leave empty to store in root folder.

The phrase file is stored after each execution of a phrase which contains this macro. If you use a PhraseExpress Server, then all clients are updated in this case. Unless you want to share the generated phrase with others, you might want to store it in a separate, local phrase file.

Temporary variables

Video tutorial

Temporary variables store any text or numeric data for re-use in one or multiple phrases.

Temporary variables are dismissed when PhraseExpress is shut down. Use {#SETPHRASE} instead, if you need to permanently store data.

Set temporary variable

{#SETTEMP} creates or updates a temporary variable.

  • -NAME VariableName defines variable's name.
  • -CONTENT VariableContents defines the text or numeric variable contents.

You can create an unlimited number of temporary variables with either unformatted text and/or numbers. Such variables can be output with the {#GETTEMP …} macro function.

This macro can be used for advanced macro programming and is much faster than {#SETPHRASE …} as it does not require to write to the phrase file.

Empty parameter -CONTENT does not delete the variable but empties the contents to allow use with {#CHECK …} conditional statements.

Output temporary variable

{#GETTEMP Name} outputs the variable of the provided name.

  • -NAME VariableName specifies the variable's name.


{#SLEEP nnnn} waits for a specified amount of milliseconds to give applications enough time to perform automated tasks invoked by PhraseExpress, e.g. loading a website.

String operations

Macro function Description
{#LENGTH Text} Outputs the length of the provided text. This macro can be useful if used together with the macros #substr and #calc.
{#LOWERCASE Text} Turns all letters of the provided text into lower case.
{#UPPERCASE Text} Turns all letters of the provided text into UPPER CASE.
{#LOWERCASEFIRST Text} Turns the first letter of the provided text into lower case.
{#UPPERCASEFIRST Text} Turns the first letter of the provided text into UPPER CASE.
{#LOWERCASEWORD Text} Turns the first letter of each word of the provided text into lower case.
{#UPPERCASEWORD Text} Turns the first letter of each word of the provided text into UPPER CASE.
{#TRIM Text} Removes any leading and/or trailing space characters of the provided text.
{#TRIMLEFT Text} Removes any leading space characters of the provided text.

Removes any trailing space characters of the provided text.

{#POS Text -SUBSTR Substring} Outputs the position as a number of the position of the first occurrence of Substring within Text.
{#REPLACE Text -OLDTEXT OldText -NEWTEXT NewText} Replaces the text in Text as provided in -OLDTEXT with the text as provided in -NEWTEXT.
{#SUBSTR Text -FROM x -COUNT y} Extracts the partial string beginning at the position as defined in -FROM with the length -COUNT.
Sample Application:


This nested macro is processed from the inside to the outside:

{#INPUT} prompts the user to enter a name. The current clipboard content is offered as a default to the user by the macro function {#INSERTCLIPBOARD}. The macro {#TRIM} removes any unwanted spaces eventually surrounding the manual input. Finally, {#UPPERFIRSTCASE …} turns the first letter into upper case.


Insert clipboard

{#INSERTCLIPBOARD} pastes the clipboard contents character-wise (key-by-key) instead of triggering the system clipboard paste (if you strike CMD-C). This specific macro is useful when you wish to use the current clipboard contents as a default value for a manual text input:


Set clipboard

{#SETCLIPBOARD Contents} fills the clipboard with the provided contents.



In this example, the clipboard is filled with the text you enter in the input dialog (keep in mind that macros are processed beginning from the innermost macro).

Table of Contents