Microsoft Outlook
ReliefJet ESSENTIALS™
for Microsoft Outlook
ReliefJet Essentials for Outlook is a comprehensive set of more than 160 tools for performing a wide range of tasks in processing email messages, contacts, appointments, meetings, tasks and other Outlook items as well as Office 365 or Exchange Server folders and mailboxes.
ReliefJet Essentials™
for Microsoft Outlook
Download  Purchase

Using macros

Macros in ReliefJet Essentials for Outlook are special sequences of characters, which the program automatically replaces with certain values in certain cases. For example, in message subjects and texts such replacements are performed by the "Expand Macros" utility. There are common macros and special macros. Common macros can be used in settings of all the utilities, in specifying utility parameters in the command line, as well as in other places, such as message subject or text, if the utility supports that. Special macros are used in certain utilities only.

Here is the general syntax for using macros:

{MACRO:position and length#format?default value}

MACRO

Macro name (always entirely in uppercase).

Position and length

One number only specifies character count to be taken from the beginning or the end of the string (if the number is negative). If two numbers separated by comma, the first number is the character position from the beginning or the end of the string (if the number is negative); the second number is the character count to be taken from the position. In this case, if the first number is negative, the characters are counter in reverse order. If you specify the first number and a comma, but with no second number, all remaining characters in the string will be taken, starting from the position determined by the first number.

Examples:

{MACRO:5} five first characters of the string;

{MACRO:-5} five last characters of the string;

{MACRO:5,3} three characters, starting from the fifth position from the beginning of the string;

{MACRO:-5,3} three characters, starting from the fifth position from the end of the string counting in the reverse order;

{MACRO:5,} the end of the string, starting from the fifth position;

{MACRO:-5,} the beginning of the string up to the fifth position from the end of the string.

Format

Advanced appearance settings for certain macros.

Default value

Value to be used when parsing the macro produces empty string.

All the parameters, except macro name, are entirely optional. Macros can be used repeatedly in the same text. You’re not allowed to use curly brackets ({ and }) inside the macros. If you need to use one of curly brackets in the macro format, use the square brackets ([ and ]) instead, and take the macro name in square brackets from the appropriate side(s) forcing the program to replace square brackets with curlies. For example, the program will automatically replace {[FIELD]#[12345]} to {FIELD#{12345}}. If you specify square bracket from one side of the macro name only, the program will replace left or right bracket respectively. For example, {[FIELD#[12345]} will produce {FIELD#{12345]}.

It is often necessary to use macros when specifying file names; for example, in utilities like "Save Attachments". In such cases, you cannot use characters that are not allowed in file names. To automatically bring a macro value to the format that is allowed in file names, add the "asterisk" (*) character immediately following the opening curly bracket: {*MACRO}. This replaces all the invalid characters with "underscore" (_).

By default, if a macro is used in the text of an HTML message, the resulting value will be inserted into the text as if you typed it in a text editor. If you want to insert the value directly into the HTML code instead of the text, add an exclamation point (!) immediately after the opening curly brace: {!MACRO}. This allows you to embed your own HTML fragments to the right places, for example, in the "Mail Merge with Attachments" utility.

Regular expressions available for more complex string construction from macros. Regular expression can be applied to any resulting macro value, except when using macros in HTML and RTF messages.

Here is the general syntax of regular expressions:

{MACRO}/regexp#format/{i}

Regexp

The .NET Framework compatible regular expression. It is not allowed to use the "forward slash" (/) and the "number sign" (#) characters inside the expression. But you can use the \x2F and \x23 code replacements respectively, if needed.

Format

Optional. If specified, it represents an arbitrary string that contains the numbers of the regular expression groups for the substitution in the form of {number?default value}, where the number is the sequence number of the group defined in the regular expression, and the optional default value specifies the string the program will use in case the group did not match. The format does not allow the use of the "forward slash" (/) character because it terminates the regular expression. In addition, you can specify zero as a number – a special number that represents the entire regular expression. Please note that if the numbers of unmatched or undetermined groups are used in the format without a question mark, then applying the entire regular expression to the macro value will cause the error!

{i}

This optional parameter shows that the regular expression should be treated as case insensitive.

Regular expression usage samples:

{SUBJECT}/^\[\w+\]/

If the message subject begins with the text like "[Prefix]" then the result of the macro would be this prefix. Otherwise, an empty string.

{SUBJECT}/^\[\w+\]\s*(.*)#{1?}/

If the message subject is in the "[Prefix] Message Subject" form, the result will be "Message Subject". Otherwise, an empty string.

{SUBJECT}/\[\w+\]$#{0}/

If the message subject doesn’t end with the text like "[Suffix]", this will result in an error.

{BODY#TEXT}/^Order \x23(\d+)#{1?0}/{i}

If the message text contains the line beginning with "Order #" (case-insensitive) following the several digits, the regular expression gets these digits or "0" otherwise.

Common macros

The following macros are common and can be used in settings of the utilities, as well as in message subjects or texts, if the utility supports it:

NOW

Current date and time

Allows specifying format string (as described below).

If no format is specified, uses the full date and time representation taken from the operating system’s regional settings.

%VARIABLE

Environment variable value

Any macro name beginning with the "percent" (%) character is treated as environment variable name (such as %COMPUTERNAME%, %USERNAME% and any other).

Example:

{NOW#d.M.yyyy H:m:s} {%VARIABLE:3?None}

Suppose that the current date is December 31, 2011, and the current time is 23:59:59, and the value of the environment variable VARIABLE is its name (i.e. VARIABLE); then the specified string will be replaced with the following:

31.12.2011 23:59:59 VAR

If the value of the environment variable VARIABLE is not set, the string will look like this:

31.12.2011 23:59:59 Non

Please note that the value of the first macro is displayed as specified in the format string, while the second one is truncated to three characters.

Here are some possible values for the format string of the NOW macro:

Format specifier

Description

Examples

d

The day of the month, from 1 through 31.

6/1/2009 1:45:30 PM → 1
6/15/2009 1:45:30 PM → 15

dd

The day of the month, from 01 through 31.

6/1/2009 1:45:30 PM → 01
6/15/2009 1:45:30 PM → 15

ddd

The abbreviated name of the day of the week.

6/15/2009 1:45:30 PM → Mon (en-US)

dddd

The full name of the day of the week.

6/15/2009 1:45:30 PM → Monday (en-US)

f

The tenths of a second in a date and time value.

6/15/2009 13:45:30.617 → 6
6/15/2009 13:45:30.050 → 0

ff

The hundredths of a second in a date and time value.

6/15/2009 13:45:30.617 → 61
6/15/2009 13:45:30.005 → 00

fff

The milliseconds in a date and time value.

6/15/2009 13:45:30.617 → 617
6/15/2009 13:45:30.0005 → 000

F

If non-zero, the tenths of a second in a date and time value.

6/15/2009 13:45:30.617 → 6
6/15/2009 13:45:30.050 →

FF

If non-zero, the hundredths of a second in a date and time value.

6/15/2009 13:45:30.617 → 61
6/15/2009 13:45:30.005 →

FFF

If non-zero, the milliseconds in a date and time value.

6/15/2009 13:45:30.617 → 617
6/15/2009 13:45:30.0005 →

g

The period or era.

6/15/2009 1:45:30 PM → A.D.

h

The hour, using a 12-hour clock from 1 to 12.

6/15/2009 1:45:30 AM → 1
6/15/2009 1:45:30 PM → 1

hh

The hour, using a 12-hour clock from 01 to 12.

6/15/2009 1:45:30 AM → 01
6/15/2009 1:45:30 PM → 01

H

The hour, using a 24-hour clock from 0 to 23.

6/15/2009 1:45:30 AM → 1
6/15/2009 1:45:30 PM → 13

HH

The hour, using a 24-hour clock from 00 to 23.

6/15/2009 1:45:30 AM → 01
6/15/2009 1:45:30 PM → 13

m

The minute, from 0 through 59.

6/15/2009 1:09:30 AM → 9
6/15/2009 1:09:30 PM → 9

mm

The minute, from 00 through 59.

6/15/2009 1:09:30 AM → 09
6/15/2009 1:09:30 PM → 09

M

The month, from 1 through 12.

6/15/2009 1:45:30 PM → 6

MM

The month, from 01 through 12.

6/15/2009 1:45:30 PM → 06

MMM

The abbreviated name of the month.

6/15/2009 1:45:30 PM → Jun (en-US)

MMMM

The full name of the month.

6/15/2009 1:45:30 PM → June (en-US)

s

The second, from 0 through 59.

6/15/2009 1:45:09 PM → 9

ss

The second, from 00 through 59.

6/15/2009 1:45:09 PM → 09

t

The first character of the AM/PM designator.

6/15/2009 1:45:30 PM → P (en-US)

tt

The AM/PM designator.

6/15/2009 1:45:30 PM → PM (en-US)

y

The year, from 0 to 99.

1/1/0001 12:00:00 AM → 1
1/1/0900 12:00:00 AM → 0
6/15/2009 1:45:30 PM → 9

yy

The year, from 00 to 99.

1/1/0001 12:00:00 AM → 01
1/1/0900 12:00:00 AM → 00
6/15/2009 1:45:30 PM → 09

yyy

The year, with a minimum of three digits.

1/1/0001 12:00:00 AM → 001
1/1/0900 12:00:00 AM → 900
1/1/1900 12:00:00 AM → 1900
6/15/2009 1:45:30 PM → 2009

yyyy

The year as a four-digit number.

1/1/0001 12:00:00 AM → 0001
1/1/0900 12:00:00 AM → 0900
1/1/1900 12:00:00 AM → 1900
6/15/2009 1:45:30 PM → 2009

:

The time separator.

6/15/2009 1:45:30 PM → : (en-US)

/

The date separator.

6/15/2009 1:45:30 PM → / (en-US)

" or '

Literal string delimiter.

6/15/2009 1:45:30 PM ("s:" h:m t) → s: 1:45 P
6/15/2009 1:45:30 PM ('s:' h:m t) → s: 1:45 P

\

The escape character.

6/15/2009 1:45:30 PM (h \h) → 1 h

Any other character

The character is copied to the result string unchanged.

6/15/2009 1:45:30 AM (a hh:mm t) → a 01:45 A

Special macros

Special macros depend on the type and application context of the utility. For example, the MAILBOX macro is available only when using command line, while FROM is available only in certain utilities that work with messages.

Here is the list of special macros:

DATE

Message date

The same formatting rules apply to message date as to the NOW macro.

SUBJECT

Message subject

When using the macro in file names, remember that message subject may be very long and may contain invalid characters. The beginning of the chapter describes how to avoid these problems.

FROM

Message sender

Display name of the email message sender.

Optionally, you can use one of the following values as a format string:

EMAIL – email address,

USER – email address user (part of the address before @),

DOMAIN – email address domain (part of the address after @),

NAME – full name,

FIRST – first name,

MIDDLE – middle name or initials,

LAST – last name,

COMPANY – company name,

PREFIX and SUFFIX – name prefix (title) and suffix (generation), these formats work only for senders and recipients from Outlook contact folders.

Example:

"{FROM#NAME?Noname}" <{FROM#EMAIL??@?}>

This string will be expanded into the full email address of the sender. When no address is specified, the result will instead appear as:

"Noname" <?@?>

TO

Message recipient

In case of multiple recipients, uses the first one on the list. This macro accepts the format of the FROM macro.

RECIPIENTS

Message recipients

The list of message, task, appointment or other Outlook item recipients.

You must specify one of the following format strings:

TO – main recipients,

CC – carbon copy recipients,

BCC – blind carbon copy recipients.

In addition, you can specify the extra format just like the FROM macro provides.

Example:

{RECIPIENTS#TO#NAME}

If the message has two recipients named Recipient 1 and Recipient 2, the result of the macro expansion would be:

Recipient 1; Recipient2

ATTACHMENTS

Item attachments

The list of Outlook item attachments.

By using the format string, you can put single or double quotation marks around each attachment’s name and specify the list separator.

Example:

{ATTACHMENTS#', }

If you have two attachments named Document 1.docx and Document 2.docx in your message, the result of macro expansion will appear as:

'Document 1.docx', 'Document2.docx'

BODY

Item body

The text of the message, calendar item, task or contact’s note in the actual format. You can specify TEXT or HTML to get the text in the required format.

Example:

{BODY#TEXT}

This will get the body of the message or any other Outlook item as a plain text.

FIELD

Field value

The value of the field or property of currently being processed Outlook item.

The mandatory format string is a name or numeric tag of the property.

Example:

{FIELD#MessageSize}

Also, some property types allow you to specify the additional format. For instance, you can use the NOW macro’s format for the date/time values:

{FIELD#LastModificationTime#M.d.yyyy H:m:s}

For logical values, you can specify two strings separated by colon for the “True” and “False” values accordingly:

{FIELD#HasAttachments#Yes:No}

FOLDER

Outlook folder

Full path to currently being processed Outlook item’s folder or folder itself.

Optionally, you can use one of the following values as a format string:

NAME – folder name only (without full path),

PATH – folder path; when using to get the item’s parent folder, the ready to use in the file system (all invalid file name characters replaced with ‘_’ character) format is applied,

ROOT – the name of the root folder full path element (mailbox, data file, etc.).

STORE

Outlook store

The name of mailbox, PST data file or any other store containing the currently being processed Outlook item, folder or the store itself.

Optionally, you can use MAILBOX or FILE (see below) as a format string.

Example:

{STORE#FILE#NAME}.{STORE#FILE#EXT}

Retrieves the store’s file name (usually PST or OST) without full path.

MAILBOX

Mailbox

Full email address of currently being processed mailbox. The macro applies only when using the Mailbox command-line parameter. The format is the same as of the FROM macro.

FILE

Data file

Full path to currently being processed PST data file. The macro applies only when using the File command-line parameter.

Optionally, you can use one of the following values as a format string:

NAME – filename only (without directory and extension),

PATH – file directory only (without filename),

EXT – file extension only (for example, PST).

Example:

{FILE#PATH}\{FILE#NAME}.txt

This string will be expanded into the full path to the file with extension replaced to .txt. I.e. if the path of the file is C:\My Files\Outlook.pst then the result will appear as: C:\My Files\Outlook.txt.



Latest News
  • ReliefJet Essentials for Outlook 4.22 is available for free download right now!

More... RSSRSS
30 Days Moneyback Guarantee
Compatible with Windows 10