Documente Academic
Documente Profesional
Documente Cultură
Introduction
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.
Example
Phrase Contents
PhraseExpress processes macro functions sequentially from left to right and replaces {#DATE}
with the current date and {#TIME} with the current time:
http://www.phraseexpress.com/docsm2/09/macro.htm 1/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Notepad
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.
Edit a macro
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.
Nesting macros
Macro functions can be nested to feed the output of one macro as a parameter of another
macro function.
http://www.phraseexpress.com/docsm2/09/macro.htm 2/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Example
Phrase Contents
PhraseExpress scans phrases from left to right and nested macro functions first from the
inside to the outside (with only few exceptions).
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):
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:
Notepad
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.
http://www.phraseexpress.com/docsm2/09/macro.htm 3/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
2 Rightclick any input field and choose from the available macro functions in the context
menu.
Check out our video blog with many step-by-step tutorials at http://www.text-
expander.com for inspirations.
Macro Functions:
Timestamp
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:
http://www.phraseexpress.com/docsm2/09/macro.htm 4/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Parameters
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.
Applications:
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.
http://www.phraseexpress.com/docsm2/09/macro.htm 5/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Examples:
Macro Output
{#DATETIME F mm/dd/yyyy hh:mm} 03/16/2016 10:47
{#DATETIME F dd.mm.yy} 16.03.2016
{#DATETIME F dddd dd.mm.yy} Thursday 16.03.16
{#DATETIME F hh:mm am/pm} 10:47 am
Date/time placeholders:
Unit Meaning
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
http://www.phraseexpress.com/docsm2/09/macro.htm 6/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Unit Meaning
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:
Phrase Contents
{#DATETIME VALUE {#DATE} S 14w}
Calendar
http://www.phraseexpress.com/docsm2/09/macro.htm 7/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
{#CALENDAR} opens a calendar and outputs the selected date in the defined format.
Parameters
Example
Phrase Contents
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.
Parameters
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.
Example
http://www.phraseexpress.com/docsm2/09/macro.htm 8/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Phrase Contents
Dear {#INPUT HEAD Name? SINGLE REQUIRED letters},
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:
Notepad
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:
http://www.phraseexpress.com/docsm2/09/macro.htm 9/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
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.
Example
Phrase Contents
http://www.phraseexpress.com/docsm2/09/macro.htm 10/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
After filling the form, PhraseExpress replaces the form macro functions with the user input and
outputs the phrase:
Notepad
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.
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.
DEF DefaultValue defines a default value that prefills the form control
Text input
{#FORMEDITBOX} adds an input box to a form.
Parameters
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.
Example
Phrase Contents
{#FORMEDITBOX TEXT Enter the URL DEF http://www.google.com SINGLE
REQUIRED URL}
The example prompts the user to enter a website address. The input box is populated with
"http://www.google.com". Input is required and checked for correct URL syntax.
Numeric input
{#FORMNUM} adds a numeric input box to a form.
Parameters
DEF value populates the input box with the provided value.
http://www.phraseexpress.com/docsm2/09/macro.htm 12/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Example
Phrase Contents
{#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.
Parameters
Example
Phrase Contents
{#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.
Drop Down
{#FORMCOMBOBOX} adds a drop down selection ("combo-box") to the form.
Parameters
VALS Output1|Output2|Output3 optionally defines alternative output for each item, each
separated by a vertical dash.
Example
Phrase Contents
{#FORMCOMBOBOX TEXT Dropdown selection ITEMS
OptionA|OptionB|OptionB VALS OutputA|OutputB|OutputC DEF OptionB
REQUIRED HORIZONTAL}
Phrase Selection
{#FORMPHRASECOMBO} adds a drop down control ("combo-box"), filled with phrases of a
specific phrase folder.
Parameter
SOURCE PhraseFolderAutotext specifies the phrase folder that populates the drop-down
control.
Example
Phrase Contents
{#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.
Parameters
http://www.phraseexpress.com/docsm2/09/macro.htm 14/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Example
Phrase Contents
{#FORMRADIOGROUP TEXT Radio buttons ITEMS OptionA|OptionB|OptionB
VALS OutputA|OutputB|OutputC DEF OptionB REQUIRED HORIZONTAL}
Group
{#FORMGROUP} groups a set of form elements and outputs the user input by customizable
enumerators.
Parameters
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 ".
Example
Phrase Contents
{#FORMGROUP TEXT Parts ENUM , LASTENUM and ITEMS
{#FORMCHECKBOX TEXT Ear VALS ear}{#FORMCHECKBOX TEXT Nose VALS
nose}{#FORMCHECKBOX TEXT Mouth VALS mouth}}
The extra space characters are intentional and part of the enumerators.
http://www.phraseexpress.com/docsm2/09/macro.htm 15/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
The example creates a group of 3 checkboxes. The checked items will be separated by ", ".
The last checked item will be separated by " and ":
Notepad
ear, nose and mouth
ear and nose
Number Slider
{#FORMSLIDER} adds a slider for number input.
Parameters
Appearance
{#FORM}specifies the form window title text and width.
Parameters
WIDTH value specifies the form window width in pixel (default is 450 px).
Text label
{#FORMTEXT} adds a text label to the form.
Parameters
http://www.phraseexpress.com/docsm2/09/macro.htm 16/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
External Data
Output
Simulate keypress
PhraseExpress can simulate keystroke combinations, e.g. to automate programs.
Application Example
Phrase Contents
http://www.phraseexpress.com/docsm2/09/macro.htm 17/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
jondoe{#TAB}password{#ENTER}
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:
CTRL, ALT, WIN/CMD, SHIFT, SPACE, BKSP, TAB, BREAK, DEL, LEFT, RIGHT,
UP, DOWN, ENTER, ESC, NUMPAD0, NUMPAD1, NUMPAD2, NUMPAD3, NUMPAD4,
NUMPAD5, NUMPAD6, NUMPAD7, NUMPAD8, NUMPAD9, MULTIPLY, ADD, SEPARATOR,
SUBTRACT, DECIMAL, DIVIDE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,
F11, F12, F13, F14, F15, F16, INS, HOME, END, PGDN, PGUP, PRTSC,
SCROLLLOCK, NUMLOCK, CAPSLOCK, NONE
Random text
{#RANDOMTEXT RandomItem1|RandomItem2} insert one of the specified texts (separated by
vertical dashes) by random. The items can also include macro functions.
Example
Phrase Contents
Notepad
With kind regards
Notepad
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.
Random number
Macro function {#RND maximum} pastes a random number between 0 and the specified
maximum value.
Example
Phrase Contents
Output:
Notepad
http://www.phraseexpress.com/docsm2/09/macro.htm 19/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
This is a random value: 23
Example
Phrase Contents
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.
Automation
Create email
{#MAIL } creates a new email with your default email client.
Parameters
TO recipient
SUBJECT MailSubject
BODY MailBody
Example
Phrase Contents
http://www.phraseexpress.com/docsm2/09/macro.htm 20/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
{#MAIL to holly@would.net subject News for you BODY {#INSERT
ExamplePhrase}}
Given, the phrase with the Autotext ExamplePhrase has following contents:
Phrase Contents
Dear Holly,
Sincerely,
Earl E. Bird
Example
Phrase Contents
{#URL http://www.phraseexpress.com}
Open Finder
{#OPENFOLDER /myfilepath} opens the specified directory in Finder.
Launch program
{#RUN} launches the specified program.
Parameters
http://www.phraseexpress.com/docsm2/09/macro.htm 21/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Example
Phrase Contents
{#RUN FILE /Applications/TextEdit.app}
Open a file
{#OPEN file} opens the specified file with the default application associated with the file
type.
Example
Phrase Contents
{#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.
Example
Phrase Contents
{#FOCUS Calculator}
The above macro changes the focus to the calculator program (if it is running).
Loop Function
{#LOOP COUNT x} repeats anything xtimes, that is, the number which
follows after 'LOOP'.
Example
http://www.phraseexpress.com/docsm2/09/macro.htm 22/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Phrase Contents
{#LOOP Example{#ENTER} COUNT 3}
The example used here uses the word 'example' three times:
Notepad
Example
Example
Example
Programming
Link phrases
{#INSERT Autotext} inserts the contents of another phrase.
Parameters
RANDOM selects a random phrase (if Autotext points to a phrase folder containing multiple
phrases).
Example
Phrase Contents
Hello,
Thank you for your offer. We will reply to you as soon as possible.
{#INSERT footer_jon}
http://www.phraseexpress.com/docsm2/09/macro.htm 23/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
At the end of above phrase you can see that it calls another phrase with the Autotext
footer_jon which has following contents:
Phrase Contents
Kind regards,
Jon Donson
Final output:
Notepad
Hello,
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.
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.
http://www.phraseexpress.com/docsm2/09/macro.htm 24/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Parameters
Phrase Contents
{#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
http://www.phraseexpress.com/docsm2/09/macro.htm 25/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Comparator Meaning
Example
Phrase Contents
{#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:
Notepad
This is Michael.
Calculate expression
{#CALC formula} outputs the result of a math expression.
Parameters
Example
Phrase Contents
{#calc sin(90)*2 ROUND 2}
http://www.phraseexpress.com/docsm2/09/macro.htm 26/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
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:
Phrase Contents
{#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:
Phrase Contents
{#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:
Phrase Contents
{#CALC $AB + $1F}
Create/Alter a phrase
{#SETPHRASE} creates/updates/deletes a phrase.
Parameters
CONTENT PhraseContents defines the phrase contents. Leave empty to delete the phrase.
http://www.phraseexpress.com/docsm2/09/macro.htm 27/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
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.
Parameters
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.
Parameter
http://www.phraseexpress.com/docsm2/09/macro.htm 28/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Delay
{#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.
{#TRIMRIGHT Text} Removes any trailing space characters of the provided text.
{#POS Text -SUBSTR Outputs the position as a number of the position of the first
Substring} occurrence of Substring within Text.
{#REPLACE Text -OLDTEXT Replaces the text in Text as provided in OLDTEXT with the
OldText -NEWTEXT text as provided in NEWTEXT.
NewText}
{#SUBSTR Text -FROM x - Extracts the partial string beginning at the position as
COUNT y} defined in -FROM with the length COUNT.
http://www.phraseexpress.com/docsm2/09/macro.htm 29/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
Sample Application:
Phrase Contents
{#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.
Clipboard
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:
Phrase Contents
{#INPUT HEAD Input? DEF {#INSERTCLIPBOARD}}
Set clipboard
{#SETCLIPBOARD Contents} fills the clipboard with the provided contents.
Example
Phrase Contents
{#SETCLIPBOARD {#INPUT HEAD Text?}}
http://www.phraseexpress.com/docsm2/09/macro.htm 30/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions
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).
Quick Access
Download
Purchase
Our Products
PhraseExpress
Mouse Recorder
ShareMouse
Company
About Us
Testimonials
Press
Blog
http://www.phraseexpress.com/docsm2/09/macro.htm 31/31