Sunteți pe pagina 1din 31

2/12/2018 PhraseExpress for Mac v2 - Macro functions

PhraseExpress for Mac v2 - Macro Functions


Table of Contents

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

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:

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.

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.

http://www.phraseexpress.com/docsm2/09/macro.htm 2/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

Example

Phrase Contents

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:

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.

To add a nested macro

1 Open the configuration dialog of an existing macro.

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.

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

­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.
http://www.phraseexpress.com/docsm2/09/macro.htm 5/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

 Output of the rounded time, e.g. "11:45am" instead of "11:39am".

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

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)

http://www.phraseexpress.com/docsm2/09/macro.htm 6/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

Unit Meaning

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:

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

­HEAD title specifies the calendar window title.

­F formatting defines the date format (see {#DATETIME …}).

Example

Phrase Contents

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.

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. Example: {#INPUT ­HEAD MyInput ­SINGLE}

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

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:

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

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:

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.

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


http://www.phraseexpress.com/docsm2/09/macro.htm 11/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

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.

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.

­MIN value defines the minimum required value.

­MAX value defines the maximum allowed 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

­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

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.

 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.
http://www.phraseexpress.com/docsm2/09/macro.htm 13/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

­VALS Output1|Output2|Output3 optionally defines alternative output for each item, each
separated by a vertical dash.

­DEF Option1 defines a preselected item.

Example

Phrase Contents

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

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

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

Example

Phrase Contents

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

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

­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

http://www.phraseexpress.com/docsm2/09/macro.htm 16/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

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 .BMP, .JPG, .PNG, .GIF

Output

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 Outputs the characters 'abc' together while pressing and


­chars abc}} holding the SHIFT - and ALT -key

{#DOWN ­COUNT 5} Simulates pressing the Arrow Down -key five times

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

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}, These keywords represent the keys on the extended number


{#SEPARATOR}, block on the far right of your keyboard (or distributed
{#SUBTRACT}, throughout if using some laptops/netbooks).
{#DIVIDE}

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

With {#RANDOMTEXT kind|best} regards


http://www.phraseexpress.com/docsm2/09/macro.htm 18/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

This phrase may output:

Notepad

With kind regards

Or by random, it could output:

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.

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.

Example

Phrase Contents

This is a random value: {#RND 100}

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

Set cursor position


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

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,

Please check your post mailbox at home.

Sincerely,
Earl E. Bird

Open a web page


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

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

­FILE FilePath specifies the program to be launched.

­PARAMS ProgramParameters defines optional 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).

 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'.

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

­ITEM Value inserts the n-th element of a phrase folder.

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.

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.
http://www.phraseexpress.com/docsm2/09/macro.htm 24/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

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:

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

!.= does not begin with

!=. does not end with

!=.= does not contain

-> Text longer than

<- Text shorter than

> Value higher than

< Value lower than

http://www.phraseexpress.com/docsm2/09/macro.htm 25/31
2/12/2018 PhraseExpress for Mac v2 - Macro functions

Comparator Meaning

>= Value equal or higher than

<= Value lower or equal than

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

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

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

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

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.

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 Name} outputs the variable of the provided name.

Parameter

­NAME VariableName specifies the variable's name.

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

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

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

© 2002-2017 Bartels Media GmbH | Imprint | Privacy Policy | Terms/Credits

http://www.phraseexpress.com/docsm2/09/macro.htm 31/31

S-ar putea să vă placă și