PhraseExpress v12 for Windows - Macro Functions

Table of Contents

Introduction

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

Macro functions can also launch programs, open documents, or websites, display message dialogs or tray hints or create input forms, link phrases, calculate math expressions and so much more…

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

Native support of the macro software Mouse Recorder turns PhraseExpress into a full-fledged automation solution.

PhraseExpress for Mac, iPhone/iPad and Android support a selection of macro functions with an adapted features set.

How it works

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

Example

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/2015. 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.
  3. Select the desired macro function in the Ribbon menu.
  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.
  2. Make the desired changes to the macro parameters.
  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.

Example

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

PhraseExpress generally scans phrases from left to right and nested macro functions 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 two inner macro functions {#INPUT} and {#RND} , so those 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.

Check out our step-by-step video tutorial blog at http://www.text-expander.com for inspirations.

 

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 http://www.text-expander.com for inspirations.

Macro Functions:

Date & Time

Timestamp

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

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

Formatting

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

Parameters
  • -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.
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.
  • Output of the rounded time, e.g. "11:45am" instead of "11:39am".
Examples:
Examples 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
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
Date/time shift examples Output
{#DATETIME} 03/16/2016 10:47
{#DATETIME -S 1d} 03/17/2016 10:47
{#DATETIME -S -2h} 03/16/2016 08:47
{#DATETIME -F mm/yyyy -S 5y} 03/2020
Perform 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:

{#DATETIME -VALUE {#DATE} -S 14w}

Calendar

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

Parameters
  • -HEAD title specifies the calendar window title.
  • -F formatting defines the date format (see {#DATETIME …}).
  • -MANUAL adds a manual date input box.
Example

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

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.

Parameters
  • -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 which allows you to dispatch the input with ENTER (vs. CTRL-ENTER). Example: {#INPUT -HEAD MyInput -SINGLE}
Example

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:

Manual input dialog

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.

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

Customer Name: {#FORMEDITBOX -TEXT Name? -SINGLE -REQUIRED}

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:

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
  • -HINT Description adds a customizable text that is shown if the mouse hovers the form control.
  • -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.

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.
  • -HIDDEN hides user input with **** characters (as known from password input dialogs).
  • -SINGLE turns the input field into a single line input field.
Example

{#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 prefilled 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.
  • -MIN value defines the minimum required value.
  • -MAX value defines the maximum allowed value.
Example

{#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
  • -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.
Example

{#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.

Parameters
  • -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.
Example

{#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.

Parameter

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

Example

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

This macro can be used for e.g. the phrase folder keeping your clipboard history (Video tutorial).

Radio button

{#FORMRADIOGROUP} adds a radio button group.

Parameters
  • -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.
  • -HORIZONTAL changes the radio button layout from vertical to horizontal to save space (make sure to use short -TEXT labels).
  • -DEF Option1 defines a preselected item.
Example

{#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.

Group

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

Parameters
  • -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 ".
Example

{#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.

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

Output examples:

ear, nose and mouth

ear and nose

Number Slider

{#FORMSLIDER} adds a slider for number input.

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

Appearance

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

Parameters
  • -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.

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

Separator

{#FORMSEPARATOR} inserts a horizontal line to visually separate form contents.

Document Generator

The Document Generator allows users to create a document by selecting multiple phrases in a easy-to-use frontend.

Please check the Document Generator manual for details.

Open File dialog

{#OPENDLG} opens the Windows dialog to select a file.

Parameters
  • -DEFEXT FileExtension specifies the file extension.
  • -DEFFILENAME FileName pre-fills the file name input box.
  • -INITDIR FileDirectory opens the dialog with the provided file directory.

The macro returns the selected file path and is useful to feed other macro functions for advanced macro programming.

Example

{#EMBEDFILE {#OPENDLG -TITLE Select MS Excel spreadsheet -DEFEXT xls -DEFFILENAME MyFile -INITDIR d:\data}}

The inner {#OPENDLG} macro prompts the user to select an MS Excel file. The selected file path is then passed to surrounding macro {#EMBEDFILE} , inserts the contents of selected file into the phrase.

Save File dialog

{#SAVEDLG} opens the Windows dialog to select a file to save.

Parameters
  • -DEFEXT FileExtension specifies the file extension.
  • -DEFFILENAME FileName pre-fills the file name input box.
  • -INITDIR FileDirectory opens the dialog with the provided file directory.

The macro returns the selected file path that can be used with other macro functions.

Example

{#OUTPUT -TARGET {#SAVEDLG -TITLE title -DEFEXT txt -DEFFILENAME Myfile -INITDIR d:\data} -CONTENT SampleContent}

The inner {#SAVEDLG} macro prompts the user to specify a text file destination. This file path is passed to surrounding macro {#OUTPUT} that saves specified contents into the file as entered.

External Data

MS Outlook Add-In

PhraseExpress can extract data from incoming emails in Microsoft Outlook.

Please check the Outlook Add-In manual for details.

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, .DOC, .DOCX

Bitmap files

.BMP, .JPG, .PNG

Microsoft Word files are supported in the Pro Edition (or higher) only and require a Microsoft Word installation.

Insert external file

{#INSERTFILE filepath} copies the contents of the specified file into the clipboard and pastes the clipboard into the target application. For Microsoft Word files, see above.

{#INSERTFILE …} replaces/combines earlier macro functions {#IMGFILE …} and {#TEXTFILE …}.

CSV file values

{#CSV} inserts a specified values of a CSV file ("comma separated values).

You can define a range of values by their start and end row/column coordinates. Multiple cells can optionally be separated with a separator text.

Parameters
  • -FILE FilePath specifies the source file.
  • -ROW Value defines the row of the desired value, starting at 1.
  • -COL Value defines the column of the desired value, starting with 1.
  • -ENDROW Value optionally defines the last row that shall be output.
  • -ENDCOL Value optionally defines the last columns that shall be output.
  • -COLSEPARATOR Text defines an optional text between each value of a column.
  • -ROWSEPARATOR Text defines an optional text between each value of a row.
Example

{#XLS -col 2 -row 2 -endcol 5 -file D:\data\file.csv -colseparator $$$}

The example would output the 2nd through 5th value in the 2nd row of file "file.csv". Each value is separated with the string $$$.

To insert the whole csv file instead of a specific values, use {#INSERTFILE …}.

This macro function replaces/extends macro function {#EXTRACTCSV} with PhraseExpress v12.0.113.

MS Excel cell contents

Video tutorial

{#XLS} inserts a specified range of cells of a Microsoft Excel spreadsheet.

You can define a range of cells by their start and end row/column coordinates. Multiple cells can optionally be separated with a separator text.

Parameters
  • -FILE FilePath specifies the Microsoft Excel file.
  • -ROW Value defines the row of the desired cell, starting at 1.
  • -COL Value defines the column of the desired cell, starting with 1.
  • -ENDROW Value optionally defines the last row that shall be output.
  • -ENDCOL Value optionally defines the last columns that shall be output.
  • -SHEET Value optionally defines a specific sheet of a multi-sheet Excel document.
  • -COLSEPARATOR Text defines an optional text between each cell of a column.
  • -ROWSEPARATOR Text defines an optional text between each cell of a row.
Example

This macro function is useful in combination with the macro functions{#GETXLSROW …} and {#GETXLSCOL …}: To output a Excel spreadsheet row, that contains specific contents, you would embed {#GETXLSCOL …}, that returns the number of the row which contains the search string. This value would be used to feed parameter -ROW of macro function {#XLS …}:

{#XLS -col 2 -row {#GETXLSCOL -search {#INPUT -head First name? -single} -file D:\data\file.xls} -endcol 5 -file D:\data\file.xls -colseparator ,}

The example would output column 2 to 5 of the row that contains the namered prompted by {#INPUT} in Excel file "file.xls".

PhraseExpress uses column numbers instead of letter coordinates (so called "R1C1 reference style") to allow you to calculate cell coordinates with the macro function {#CALC …}.

To insert the whole spreadsheet instead of a range of cells, use {#INSERTFILE …}.

This macro function replaces/extends macro function {#EXTRACTCELL} with PhraseExpress v12.0.113 and requires a Microsoft Excel installation.

Find MS Excel column

{#GETXLSCOL -search String -file Excel file}

Returns the column coordinate (beginning with 1) of the specified Microsoft Excel spreadsheet, that contains the specified search string.

Parameters:
  • -SEARCH defines search string.
  • -FILE FilePath specifies the source file.
  • -SHEET Value optionally defines a specific sheet of a multi-sheet Excel document.

This macro function requires a Microsoft Excel installation.

Find MS Excel row

{#GETXLSROW -search String -file Excel file}

Returns the row coordinate (beginning with 1) of the specified Microsoft Excel spreadsheet, that contains the specified search string.

Parameters:
  • -SEARCH defines search string.
  • -FILE FilePath specifies the source file.
  • -SHEET Value optionally defines a specific sheet of a multi-sheet Excel document.

This macro function requires a Microsoft Excel installation.

XML value

{#EXTRACTXML} inserts a XML file value.

Parameters
  • -FILE FilePath specifies the source file.
  • -XPATH XPath defines the xpath value (see Wikipedia).
Example

{#EXTRACTXML -XPATH //path/value/ value -FILE D:\data\file.xml}

This macro function can be used as a data bridge to external databases which can create an XML file.

Windows environment variable

Macro function {#ENV %variable%} inserts the specified Windows environment variable (see Wikipedia).

Example

The operating system is {#ENV %os%} and the user name is {#ENV %user name%}

Above phrase will be output as follows:

The operating system is Windows_NT and the user name is Jon Donson

ActiveDirectory variable

Macro function {#ADLDAP variable name} inserts the specified LDAP variable into the phrase.

This macro is useful e.g. for email signatures which are dynamically filled by the ActiveDirectory variables.

Example

Kind regards,

{#ADLDAP Name}

Phone {#ADLDAP Phone}

PhraseExpress renders the phrase at the time of its execution as follows:

Kind regards,
Jon Doe
Phone (203) 345-674

Output

Simulate keypress

PhraseExpress can simulate keystroke combinations, e.g. to automate programs. For advanced automation tasks also check the macro function {#mouserecorder …}.

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

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, 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, LWIN, RWIN, NONE

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.

{#ADD}, {#MULTIPLY}, {#SEPARATOR}, {#SUBTRACT}, {#DIVIDE}

 

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.

Example

With {#RANDOMTEXT kind|best} regards

This phrase may output:

With kind regards

Or by random, it could output:

With best regards

Output to file

{#OUTPUT} saves text into a file.

Parameters
  • -CONTENT Text specifies the contents to be saved.
  • -TARGET FilePath defines the target file name/path.
Example

{#OUTPUT -TARGET {#SAVEDLG -TITLE Where to save the file?} -CONTENT {#DOCGEN}}

This example runs the Document Generator and saves its generated output into a file. The file destination is defined by the user with the help of the "Save file…" dialog.

This macro function requires a Microsoft Word installation.

E-Mail attachment

{#PASTEFILE FilePath} pastes the specified file to the target application by using the Windows clipboard.

This is useful to attach a file to an open email message window.

Example

{#PASTEFILE D:\data\brochure.pdf}

If this macro is executed in an open Outlook email window, Outlook will add the specified as an email attachment to this message.

You may need to add a {#SLEEP} macro to give Outlook some time to process the data.

Message window

{#MSGBOX} opens a message window.

Parameters
  • -HEAD Text specifies the window title.
  • -TEXT MessageText contains the actual message text.
  • -YES Autotext branches to another phrase with that Autotext if the "Yes" button is pressed in the message dialog box.
  • -NO Autotext branches to another phrase with that Autotext if the "No" button is pressed.
  • -CANCEL Autotext branches to another phrase with that Autotext if "Cancel" has been pressed.
  • -DEFAULTNO sets the input focus to the "No" button.
Example

{#MSGBOX -HEAD I am a messagebox -TEXT This is some sample text -YES ##yesclick -NO##noclick -DEFAULTNO}

This example shows a message box. It inserts the phrase with the autotext ##yesclick if the "Yes" button is clicked. If "No" is pressed, the contents of the phrase with the autotext ##noclick is inserted.

Notification

{#BALLOON} shows a clickable notification near the Windows system tray:

Parameters
  • -TITLE Text defines the notification title.
  • -TEXT NotificationText defines the actual notification text.
  • -ONCLICK Text may define text or macro functions that are executed if the notification is clicked.
Example

{#BALLOON -TITLE Headline -TEXT TextContents -ONCLICK OutputIfClicked}

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

The MS Windows utility Charmap provides an overview of the special characters including their code.

Random number

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

Example

This is a random value: {#RND 100}

Output:

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.

Example

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

Mouse Recorder Automation

{#MOUSERECORDER name} launches Mouse Recorder and playback the macro automation which has been created in Mouse Recorder through PhraseExpress.

The automation data is stored in the macro (i.e. the phrase file/database).

Double-Click the macro to edit the automation in Mouse Recorder.

Automation playback and editing requires an installed Mouse Recorder.

Create email

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

Parameters
  • -TO recipient
  • -CC cc-recipient
  • -BCC bcc-recipient
  • -SUBJECT MailSubject
  • -BODY MailBody
  • -ATTACH FilePaths
Example

{#MAIL -to holly@would.net -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.

Sincerely,
Earl E. Bird

The resulting email:

Email

Strange characters in the mail body may be caused by email programs with UTF-8 character encoding (e.g. Microsoft Outlook ). In such a case, please enable UTF-8 support in the PhraseExpress expert settings.

Multiple file attachments can be separated by a vertical line. Example: -ATTACH C:\file1.txt|C:\file2.txt

If the attachment file names contain space characters, you must enclose the path in "".

The #mail macro offers additional features if using Microsoft Outlook, such as definition of a file attachment and unlimited body text length. On the other hand, email sent using the mailto: system command only offers a limited body text length. Reduce the amount of text if an error message occurs.

Open a web page

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

Example

{#URL http://www.phraseexpress.com -WAIT -TIMEOUT 10000}

Parameter -WAIT pauses the phrase execution until the web page is fully loaded (IE only) or after the optional timeout (in seconds).

Open File Explorer

The above macro function {#OPENFOLDER "c:\path"} opens the specified file folder in Windows Explorer.

Example

{#OPENFOLDER "C:\Windows"}

This example opens the file folder c:/Windows in the File Explorer.

Parameter -SELECT highlights the specified folder in File Explorer.

{#OPENFOLDER "C:\Windows" -select}

Launch program

{#RUN} launches the specified program.

Parameters
  • -FILE FilePath specifies the program to be launched.
  • -PARAMS ProgramParameters defines optional parameters.
  • -WORKDIR FolderPath optionally defines the working directory.
Example

{#RUN -FILE "notepad.exe"}

If the desired application is not registered in Windows, you need to enter the full program path.

Open a file

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

Example

{#OPEN d:\data\example.txt}

Switch focus

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

Example

{#FOCUS Calculator}

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

You can also use a wildcard * within the windows title definition.

Loop Function

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

Example

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

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

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).
  • -ITEM Value inserts the n-th element of a phrase folder.
Example

Hello,

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:

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.

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.

Parameters
  • -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

Nested Macro functions are interpreted from inner to outer macros. Beginning with PhraseExpress v12 {#CHECK } macro branches are interpreted after the comparison.

Example

{#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.

Parameters
  • -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.
  • If you use the value "auto" for -ROUND, -DECIMALMARK or -THOUSANDS, the output format adapts to the format of the input.
Example

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

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

Supported functions and operators:

ln, sin, cos, tan, ctg, abs, sqrt, !, ^, /, *, -, +.

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.

Parameters
  • -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.

Parameters
  • -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} outputs a variable.

Parameter
  • -NAME VariableName specifies the variable's name.

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.

You can customize system-wide delays in the PhraseExpress settings.

Set paste method

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

Dear Mr. {#UPPERCASEFIRST{#TRIM {#INPUT -HEAD Name? -DEF {#INSERTCLIPBOARD} -SINGLE}}}

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.

Clipboard

{#CLIPBOARD -COPY} copies text into the Windows clipboard which is currently highlighted in any application.

{#CLIPBOARD -PASTE} This macro pastes the current Windows clipboard contents at the current cursor location within a phrase.

{#CLIPBOARD -CUT} cuts out the current text selection into the Windows clipboard.

Insert clipboard

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

{#INPUT -HEAD Input? -DEF {#INSERTCLIPBOARD}}

Set clipboard

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

Example

{#SETCLIPBOARD {#INPUT -HEAD Text?}}

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

Keyboard layout

Set Keyboard Language

{#SETLAYOUT Language-ID} changes the Windows keyboard layout language.

Example

{#SETLAYOUT 00000407}This text will be pasted with German keyboard layout settings.

{#SETLAYOUT 00000409}This text will be pasted with US-American keyboard layout settings.

{#SETLAYOUT 00000407}This text will be pasted with German keyboard layout settings again.

This macro changes the Windows keyboard settings permanently.

Retrieve Keyboard Language

{#GETLAYOUT} retrieves the current keyboard language scheme. Following example saves the current keyboard language into a temporary variable:

{#SETTEMP -NAME CurrentLayout -CONTENT {#GETLAYOUT}}

After any keyboard layout operation, the original keyboard layout can be restored from the temporary variable with following macro:

{#SETLAYOUT {#GETTEMP CurrentLayout}}

A list of language identifiers is available at Microsoft MSDN web page.

Table of Contents