6. Macro tags for Corbit

In the list below you will find the macro tags available throughout the Corbit setup. By selecting a macro the more detailed description of that macro will show.

Some macro tags are only available in in certain fields in the setup. The description of the macro tags will let you know of any such restrictions. If no special usage is specified in the description field the macro tag may be used in all macro fields.

Macro list
%, EMAIL_SENT IMAGE_WIDTH REPLACE_ALL
ASSET_ID ASSET ASSET_LIST ASSET_XML
ASSET_CATALOG_ID BASE64_DECODE CLIPPING_PATH_LIST DATE_CHANGE
%% EMAIL_SUBJECT INDEX SFN
EMAIL_TO SET_BUCKET SEPARATE SEPARATE_BY_ROW
ACTION_NAME EXIF INDEX_OF SOURCE_FILE_EXISTS
APP F IPTC SOURCE_FOLDER_FILE_COUNT
BASE64 FILE_CONTENT LAST_INDEX_OF SOURCE_NAME
BASE64_FROM_FILE FILE_DIMENSION LENGTH WORKFLOW_BUCKET
BUCKET FILE_DIMENSION_H LOWER WORKFLOW_NAME
BUCKET_FILE_COUNT FILE_DIMENSION_W MATH STRIP
BUCKET_FILE_NAME_LIST FILE_EXISTS META SUBSTRING
BUCKET_LIST FILE_PAGE_COUNT MOD SXML
BUCKET_LIST_REMOVE_DUPLICATES FILE_PARENT_PATH MOD_TIME TRIM
CASE FILE_PATH MP3_ALBUM UPPER
CHAR FILL MP3_ARTIST UUID
D FILTER_NAME MP3_COMMENT XMP
DATE_COMPARE FOLDER_FILE_COUNT MP3_GENRE XPATH
DUPLICATE_FILE_EXTRA FOLDER_SIZE MP3_TITLE XPATHEL
E FOR_EACH_IN_LIST MP3_TRACK XPATHLIST
EML TEXT_CONTENT FILE_LIST
EMAIL_BODY FORMAT_DATE MP3_TRACKCOUNT ZIPF
EMAIL_RECEIVED FREE_INDEX MP3_YEAR SYSTEM_BUCKET
EMAIL_SENDER_ADDRESS HTML_ENCODE NR DATE_CHANGE  
EMAIL_SENDER_NAME IMAGE_HEIGHT PF JSON  
REMOVE_BOM SFN2 URL_ENCODE XPATHLISTEL  
CSV_PARSE_ROWS CSV_PARSE_COLS SEPROWNUM SEPCOLNUM  
SEPVALUE SEPHEADER SEPROWVALUE_BY_COL SEPROWVALUE_BY_HEADER  
Macros

%,

Special macro that will return a single comma character ','.

%%

Special macro that will return a single percent character '%'.

%ACTION_NAME%

The name of the action in the current context where the macro is evaluated.

%ASSET_ID%

This macro will return a Portfolio asset ID. The returned ID is from the current asset in the handling scope, see the section Assets in scope for more details.

%ASSET[<key>]%

This will get the field named key from the current asset in the handling scope, see the section Assets in scope for more details.
If, for example the field Filename is wanted the macro %ASSET[Filename]% should be used. The key is case sensitive.

%ASSET_LIST[<key>,<delimiter>]%

This macro is similar to the ASSET macro above. The difference is that the ASSET_LIST macro is used when the value of the field key may have multiple values, for example the field Keywords.
The delimiter is the character sequence that will be used to separate the values and create the result text.

Example: If we have an asset with the field Keywords set to Apple and Banana, the macro %ASSET_LIST[Keywords,#]% would result in Apple#Banana.

%ASSET_XML%

This macro will return a XML structure for the current asset in the handling scope, see the section Assets in scope for more details.
The XML output will have the following structure;

 

<asset id="[id]" [field name]="[value]" ...>

<[field name]>[value]</[field name]>

<[field name]-list>

<[field name]>[value]</[field name]>

</[field name]-list>

...

</asset>

 

Each key in the asset that is of type boolean,datetime,decimal,number or url will be in the root asset parameter list along with the asset ID.
Fields of type geojson, geopoint, picture, string or textblocks will have their own tags (the tag name is the field name).
Other fields that may have multiple values will be added in their own tags that are named as the field name with an added '-list'.
This tag then contains all separate values in tags that are named as the field name.

For example, if an asset has the field Keywords with values Apple and Banana the output would be

 

<asset id="12345" ...>

<Keywords-list>

<Keywords>Apple</Keywords>

<Keywords>Banana</Keywords>

</Keywords-list>

...

</asset>

From this ASSET_XML macro XPATH macro may be used to fetch specific values.

%ASSET_CATALOG_ID%

Will return the catalog-ID that belongs to the current Portfolio Asset. This macro is only useful if there is such an asset in the current scope.
This is available in the scope if you e.g. have a Portfolio Source or if you have a “for-each-asset-action”

%APP[<key>]%

This macro is mainly for internal use.

In the container of the running application, servlet or applet there are some internal parameters which may be called with this macro. The parameter key differs for each container.

%BASE64[<text>, <optional encoding>]%

This will take a text and make a base64 encoded text from it. The optional encoding may be used if the source text is in a specific format.

%BASE64_DECODE[<text>]%

This macro is the opposite to BASE64. The macro will handle a BASE64 coded text and decode it.
As an example: using %BASE64_DECODE[%BASE64[this is a text]%]% will give the result ”this is a text”, (First it will be coded as BASE64, and then it will be decoded.

%BASE64_FROM_FILE[<path>]%

This will take a file and put create a Base64 encoded string from the content. The path argument is the full path to the file to encode.

%BUCKET[<key>]%

Gets a value from the object's bucket (i.e. the object that is currently being handled). This can for example be useful in an action to get a value from another action that has been invoked before the current action.

The <key> is the key that previous action has used to put the value in the bucket. See the documentation for different actions to see what they put in the bucket.

Note that the Workflow itself also puts some values in this bucket before any action is executed.

Note that this bucket is different from the Workflow bucket which may be used with the macro %Workflow_BUCKET[...]%.

Read more about the different buckets in chapter 2.

%BUCKET_FILE_COUNT[<key>,<onlyFiles>]%

This will return the number of files that are present in the object bucket with the key <key>. If <onlyFiles> is equal to 'true' then the count will only include the files, if 'false' the count will include files and folders. The value in the bucket has to be a list of files (see different actions for more information what they put into the bucket).

%BUCKET_FILE_NAME_LIST[<key>,<onlyFiles>]%

This will return the names of files that are present in the object bucket with the key <key>. If <onlyFiles> is equal to 'true' then the names will only include the files, if 'false' the names will include files and folders. The value in the bucket has to be a list of files (see different actions for more information what they put into the bucket).

The returned list is a comma separated list of file names.

%BUCKET_LIST[<key>,<delimiter>]%

This is a macro that will join a list to a single string with a certain delimiter.

This macro will take a bucket value, regard this value as a list of items (for example from the special -list bucket key created in the database action) and join these items with the specified delimiter.

Example: If the bucket key paper-list contains a result list from database action and has the following items: news, sports, ads. Using the macro %BUCKET_LIST[paper-list,#]% will result in the following string: news#sports#ads

NB! If a comma (,) is wanted as the delimiter, the comma must be preceeded with a percent sign (%,).

%BUCKET_LIST_REMOVE_DUPLICATES[<key>]%

This macro will work on a bucket list (e.g. a value from a database call). The macro will not return anything, it will only remove all the duplicate entries in the given bucket value.

Example: If the bucket key paper-list contains a result list from database action and has the following items: news, sports, news, ads. Using the macro %BUCKET_LIST_REMOVE_DUPLCIATES[paper-list]% will change the items in the bucket, resulting in the following items: news, sports, ads

%CASE[<exp>,<t>,<f>]%

This macro is evaluating a condition and will return different values depending on the condition result.

The paramater <exp> which is evaluated must be a valid expression, see below.

If the expression is evaluated to true, the <t> text (which may contain other macros) is parsed and returned. If the expression is false the <f> text is parsed and returned.

The expression <exp> must contain one (the first occurance is taken) of the following mathematical expression

Expression Meaning Description
< less than This expression is only valid if the left and right component are numbers.
<= less than or equals This expression is only valid if the left and right component are numbers.
> bigger than This expression is only valid if the left and right component are numbers.
>= bigger than or equals This expression is only valid if the left and right component are numbers.
== equals Checks if the left and right components are equal.
<> not equals Checks if the left and right components differ.

%CHAR[<no>]%

Will return the character that has the unicode decimal number <no>.

%CLIPPING_PATH_LIST[<path>,<bucket>]%

path may be empty, then the current file will be used as source, otherwise the path is used as source for which file to be analyzed. bucket specifies which bucket value should be set.
The bucket values will be a list (where you as an example later may use %BUCKET_LIST…%) with the name of all clipping paths that an image file contains.

%CSV_PARSE_ROWS[<text>,<handling>]%

%CSV_PARSE_ROWS[<firstRowHeader>,<text>,<handling>]%

This macro is similar to %SEPARATE_BY_ROW[…]% but will expect CSV structured text that will handle quotes etc.


Parameters:
firstRowHeader This value should be 'true' if the first row in the text will be taken as the header row. The header values may be used in other macros in the handling, for example %SEPHEADER%. If this parameter is omitted, it's default value is true.
text The source text that is being separated into rows
handling This will be the handling for each row of the CSV text. Normally the macro %CSV_PARSE_COLS[…]% will be part of the handling.

%CSV_PARSE_COLS[<text>,<handling>]%

This macro is used to separate a single row of a CSV formatted text. This macro is normally used within the handling parameter of the macro %CSV_PARSE_ROWS[…]%.


Parameters:
text The source text that is being separated into single column values
handling This will be the handling for each column of the CSV text.

%D%

%D[<format>]%

%D[+<d>,<format>]%

%D[-<d>,<format>]%

Simple form

In the simple form, returns the current date in the format yyyy-MM-dd.

Variant [<format>]

If <format> is specified the result will be in the specified format. The format may contain special characters such as dot (.), comma (,) (note! if a comma is to be used as separator it must be escaped with a '%' in order to be handled correctly) and hyphen (-). The characters below shows how to get a certain format. The number of each character decide the result date string, e.g. in the year 2006, yyyy would result in 2006 while yy gives 06.

Format character Description
y The year
M The month in year
w The week in year
W The week in month
D The day in year
d The day in month
E Day in week as text
a AM/PM
H Hour in day (0-23)
k Hour in day (1-24)
K Hour in am/pm (0-11)
h Hour in am/pm (1-12)
m Minute in hour
s Second in minute
S Millisecond

Variant[+<d>,<format>] or [-<d>,<format>]

If the first parameter starts with a plus sign or minus sign the specified <d> number of days will be added or withdrawn respectively from the current date before the result is calculated. The <format> is as described above.

%DATE_CHANGE[<source date>, <source format>, <unit>, <amount>, <output format>]%

This macro will use a date/time and will then add (or subtract if a negative number is used) and return the new date/time.
sourcedate is the input date/time
sourceformat is the format of how the sourcedate is specified.
unit indicates one of the following (day, hour, minute, second) and is then the unit to be changed.
amount indicates how many of a given unit that should be added (or subtracted if a negative number is used)
outputformat specifies the desired final format of the time output.

Example: %DATE_CHANGE[2022-05-04,yyyy-MM-dd,day,7,ww]% Will return the week number if 7 days is added to the date 2022-05-04, so the result would be “19”

%DATE_COMPARE[<date1>, <date1 format>, <date2>, <date2 format>]%

This macro will compare two dates and return the difference in seconds between them.

The parameter date1 and date2 are strings representing dates. Each of them should conform to the date1 format and date2 format (see macro %D% for more information about the formats).

The returned value is the difference between the two dates in seconds. If the dates are the same 0 is returned. If date1 is before date2 a negative number is returned.

%DUPLICATE_FILE_EXTRA[<text>]%

This macro is only used in actions where a destination file is created. This macro will have no effect if the file that is created does not exists. If the file being created exists this macro will determin how a new name will be created. Note that the special macro %FREE_INDEX% may be used in this macro's text parameter.

In most cases where this macro may be used there is a checkbox in the setup allowing the file to be overwritten. This checkbox has no effect if this macro is used in the action.

This macro replaces the setup in Corbit version 5 and older where the user could specify a prefix to add to the file name if the result file existed. With this macro the file name may be changed in more ways than just a prefix.

NB! This macro can not currently be used in the FTP send action!

 

Example 1

If we have setup a workflow where a source file is detected and moved to a destination folder and a file with this name already exists in the destination folder we could use the checkbox in the move action allowing us to overwrite the destination file with our newly found file.

If we want to keep both files in the destination folder we must change the name for this new file. Let's assume we would like to add a hash character (#) and a running number on the new file. We would then use the name change field in the move action and put the following value:

%F%%DUPLICATE_FILE_EXTRA[#%FREE_INDEX%]%%E%

In the example above the bold text is the magic which is added if the file is a duplicate file. Without the duplicate macro the file name would become %F%%E%, i.e. the original file name.

If we rather have the string 'version X' in front of the file name in case of duplicate (where X will be the first available number) we could use the following in the name change field:

%DUPLICATE_FILE_EXTRA[version %FREE_INDEX%]%%F%%E%

 

%E%

Note that this macro is only useful in the context where a single file is referred.

File name suffix (dot included) if any. If the file does not have any suffix an empty string is the result.

%EML%

%EML[output=xxx]%

Gets the eml content of the email in scope (must be used with an email source in the workflow).

Note that the eml content may be large so preferrably the variants are used to write a file.


Output (index 1) is the path to a file where the result will be written to.

If output is used, the result from the macro itself will be empty, all content is written to the output file.

%EMAIL_BODY%

%EMAIL_BODY[<mime>]%

Simple form

If the object being handled is an email this will return the body of the email. If the email contains more than one body the returned text will primarly be the plain text body, secondly the html coded body will be returned.

Variant [<mime>]

This will primarly return the email body in the special mime format <mime>. If the email does not contain any body in the specified mime format an empty string is returned. Example of mime types: text/plain or text/html

%EMAIL_RECEIVED%

%EMAIL_RECEIVED[<format>]%

%EMAIL_RECEIVED[+<d>,<format>]%

%EMAIL_RECEIVED[-<d>,<format>]%

This will, if the object being handled is an email, return the email's received date.

This macro works as the date macro %D% with all the variants of parameters.

%EMAIL_SENDER_ADDRESS%

If the object being handled is an email, this will return the sender's email address.

%EMAIL_SENDER_NAME%

If the object being handled is an email, this will return the sender's full name.

%EMAIL_SENT%

%EMAIL_SENT[<format>]%

%EMAIL_SENT[+<d>,<format>]%

%EMAIL_SENT[-<d>,<format>]%

This will, if the object being handled is an email, return the email's sent date.

This macro works as the date macro %D% with all the variants of parameters.

%EMAIL_SUBJECT%

If the object being handled is an email, this will return the email's subject text.

%EMAIL_TO%

Similar to the macro EMAIL_SENDER_ADDRESS (that will fetch the address that an email was sent from).
EMAIL_TO will return the address of which the current email is sent to. If the email is sent to multiple recipients all the addresses will be received with a comma in between.

%EXIF[<no>]%

If the object being handled is an image with EXIF information, this will return the EXIF information found in EXIF field number <no>.

%F%

%F[<s>,<e>]%

%F[O,<ch>]%

%F[O,<ch>,<no>,<l>]%

%F[OI,<index>,<no>,<l>]%

Note that this macro is only useful in the context where a single file is referred.

Simple form
The file name stem (i.e the file name but without the file name suffix and belonging dot).

Variant [<s>,<e>]

Part of the file name stem. Start at index <s> (the first character has index 1) and end at index <e>. If <s> is not specified, 1 is used. If <e> is missing the last character index is used. Note that the comma characters must be present even if either <s> or <e> is left out.

Variant [O,<ch]>

The first parameter is the letter 'O'. This gives a part of the file name stem starting at the first character and take all characters before the first occurance of <ch>. If <ch> is not found in the file name the result is the same as %F%.

Variant [O,<ch>,<no>,<l>]

The first parameter is the letter 'O'. This gives a part of the file name stem starting at the first occurance of <ch>. Then move <no> steps (a minus sign may preceed <no> to go backwards). This is now the start position and <l> number of characters are read. If <l> is missing the rest of the file name stem is read. Note that the last comma must be present even if <l> is left out.

Variant[OI,<index>,<no>,<l>]

The first parameter is the letters 'O' and 'I'. This gives part of the file name stem starting at character <index> (first character is index 1, if the last character is wanted then use -1). Then <no> (number) steps will be taken (minus sign may preceed <no> to go backwards). This is the start and from here <l> number of characters are read. If <l> is missing the rest of the file name stem is read. Note that the last comma must be present even if <l> is left out.

%FILE_CONTENT%
%FILE_CONTENT[<file>,<format>,<start>,<end>]%

Reading the file with path <file> (the path is depending on the environment from which this macro is called) and returns the content in the file in the selected text format <format>.

If the format is omitted, 'UTF-8' is used as default format. Note that the comma must be present even if <format> is left out.

Optionally the <start> and <end> parameters may be used. These will indicate the start and end location to get a portion of the file content. The start and end parameters are the byte location. The first location in the file is zero (0).

The simple macro without any parameters will get the content of the file currently in the scope of the macro.

When using parameters the <file> parameter may be empty in which case the file currently in scope will be used, e.g. %FILE_CONTENT[,ISO-8859-1]%

%FILE_DIMENSION[decimals=0, pdfBox]%

This macro is only useful in contexts where a file is present.

This will get the file dimensions in mm. The returned value will be the width followed by a ' x ' (space, x and then another space) followed by the height value.

The first parameter is the number of decimals to use, if this parameter is missing the default value is set to zero (0) decimals.

The second parameter is only useful when the file is a PDF file. This is then the PDF box to use when getting the dimension. If this is left out the default order will be trimBox,mediaBox,cropBox,bleedBox,artBox.

Also see macro FILE_DIMENSION_W and FILE_DIMENSION_H for more information.

%FILE_DIMENSION_H[decimals=0, pdfBox]%

This macro is similar to FILE_DIMENSION but will only get the height value.

%FILE_DIMENSION_W[decimals=0, pdfBox]%

This macro is similar to FILE_DIMENSION but will only get the width value.

%FILE_EXISTS[<path>]%

Checks if a certain file (with the path <path>) exists. This will return "true" if the file exists and "false" otherwise. The path that is given must be availalbe from the Corbit server. See also %SOURCE_FILE_EXISTS[...]%.

%FILE_PAGE_COUNT%

%FILE_PAGE_COUNT[<path to file>]%

Returns the count of pages in the file. Teh default macro without any parameter will check the current file in context. If the parameter is present this will be taken as the path to the file to check.

Only PDF files will be calculated with their real page count, other files will return 1.

%FILE_LIST%

%FILE_LIST[path=C:/mypath]%

XXxx

Possible parameters for FILE_LIST

Name Default value Description
path Path of current folder in scope if any The absolute path to the folder to list
separator ; (semi colon) The separator to be used between entries in the result String
result_as_name false The separator to be used between entries in the result String
include_folders false If true, folder entries will be part of the result String
search_subfolders false If true, subfolders will be handled recursively
include_hidden false If true, hidden file and folder entries will be included in the result
include_zerosized false If true, files and folder with the length 0 will be included in the result

Example;

%FILE_LIST[separator=###,include_folders=true]%

%FILE_LIST[result_as_name=true,separator=#]%

%FILE_PARENT_PATH%

Note that this macro is only useful in the context where a single file is referred.

The current file's parent folder path.

%FILE_PATH%

Note that this macro is only useful in the context where a single file is referred.

The full path to the current file.

%FILL[<start | end>,<text>,<filler>, <max length>]%

This will fill the <text> with a certain <filler>. The first parameter is either start or end depending on whether you want the filler to precede or append the text. The max length

parameter is the max number of characters that the result will have.

Example) Using %FILL[start,12345,0,10]% will result in 0000012345

%FILTER_NAME%

The name of the filter in the current context where the macro is evaluated.

%FOLDER_FILE_COUNT[<path>]%

This macro will check a certain folder (disc folder available from the Corbit server), count all the files in that folder and return the count.

The result is the number of non-hidden files (excluding folders) found directly in the folder.

%FOLDER_SIZE[<path>]%

This macro will check a certain folder (disc folder available from the Corbit server), count the number of bytes of all files, including subfolders and return the count.

The result is the byte size of all non-hidden files (including subfolders) found in the folder.

%FOR_EACH_IN_LIST[key,tmpKey,macro]%

This macro will act on each item in a bucket list.

The key parameter is the bucket key that currently holds a list of values (for example from a database search).

The parameter tmpKey can be any value and this will be used to place each entry in the bucket list to perform whatever is set in the macro parameter. Make sure that you use a unique value for the tmpKey parameter.

The last parameter, macro, can be any other macro or static text. Each entry in the bucket list will be set to the result of this macro parameter.

Example:

LEt us assume we have a database search where we have saved a list of values in the bucket key dbResult-list. TLet us further assume that the values in this list are a set of dates on the format yyyy-MM-dd and we want to change this format on each element in the list to the new format dd/MM/yyyy.

When using this macro we must make sure that the temporary key that we specify is unique or we may set a current bucket key to a fault value. In this case we will use the name tmpValue.

The resulting macro will be (the last parameter, macro, is in bold text for clarification purpose)

%FOR_EACH_IN_LIST[dbResult-list,tmpValue,%FORMAT_DATE[%BUCKET[tmpValue]%,yyyy-MM-dd,dd/MM/yyyy]%]%

 

%FORMAT_DATE[<text>,<from>,<to>]%

This macro is used to convert a text from one date format to another. For the different pattern characters, see the %D% macro.

The <text> is the source date specified in the <from> format. The result is the same date specified in the <to> format.

%FREE_INDEX%

This macro is a special macro only used within the macro %DUPLICATE_FILE_EXTRA[...]%

This macro will return the first free index in a duplicate file scenario.

%HTML_ENCODE[<text>]%

Returns a HTML formated text based on the <text>. Entities such as ä will be used instead of ä and so on.

%IMAGE_HEIGHT[<format>]%

Returns the image height of the currently handled image file (if any). The format parameter is optional and may be either mm or px resulting in the image height specified in millimeters and pixels. If the format parameter is not present (using %IMAGE_HEIGHT%) the height is returned in pixels.

%IMAGE_WIDTH[<format>]%

Returns the image width of the currently handled image file (if any). The format parameter is optional and may be either mm or px resulting in the image width specified in millimeters and pixels. If the format parameter is not present (using %IMAGE_WIDTH%) the width is returned in pixels.

%INDEX%

Special macro used in PDF split action where the current index of the split PDF could be used in for example the resulting file name.

%INDEX_OF[<s>,<t>,<start>]%

The text <s> is searched and the index of the first occurance of <t> is returned. The index is zero based meaning that if <s> starts with <t> the returned index is '0'. If the <t> is not found in <s> -1 will be returned.

Both <s> and <t> might contain macro text themselves.

If the optional <start> parameter is present this is the start index in the text from which the search starts. Any occurance of <t> before this index is not counted. The <start> index is zero-based meaning that the first character in <s> has the index 0 (zero).

%IPTC[<no>]%

If the object being handled is an image with IPTC information, this will return the IPTC information found in IPTC field number <no>.

NB This will only read from the regular IPTC information, not the XMP information. For XMP data use the XMP macro.

%LAST_INDEX_OF[<s>,<t>,<start>]%

The text <s> is searched and the index of the last occurance of <t> is returned. The index is zero based meaning that if <s> starts with <t> the returned index is '0'. If the <t> is not found in <s> -1 will be returned.

Both <s> and <t> might contain macro text themselves.

If the optional <start> parameter is present this is the index in the text from which the search starts (seen from the end). Any occurance of <t> after this index is not counted. The <start> index is zero-based meaning that the first character in <s> has the index 0 (zero).

%LENGTH[<text>]%

Returns the length of the <text>. The number of characters in <text> is counted and returned.

This macro may be very useful used for example in an expression, see macro CASE for more information.

%LOWER[<text>]%

The returned value is <text> where each character is in lower case in the returned value.

%MATH[<math command>, <leftExpression>, <rightExpression>, <decimals>]%

This will invoke the mathematical expression <math command> on the <leftExpression> and <rightExpression>. The returned number will have the maximum decimal count that is expressed in the parameter <decimals>. The <leftExpression> and <rightExpression> may contain numbers (possibly from other macros).

The <decimals> parameter is optional. If <decimals> is left out the last comma should also be left out.

The <math command> may be any of the following;

Math command Description
+ Will add <leftExpression> with <rightExpression>, e.g. %MATH[+, 12, 3]% will return '15'
- Will subtract <leftExpression> with <rightExpression>, e.g. %MATH[-, 12, 3]% will return '9'
* Will multiply <leftExpression> and <rightExpression>, e.g. %MATH[*, 12, 3]% will return '36'
/ Will divide <leftExpression> with <rightExpression>, e.g. %MATH[/, 12, 3]% will return '4'

%META[<id>]%

This macro is not currently used in Corbit.

%MOD%

%MOD[<format>]%

%MOD[+<d>,<format>]%

%MOD[-<d>,<format>]%

Note that this macro is only useful in the context where a single file is referred.

The macro will return the modification time for the current referenced file. The variants for the macro follow the D macro where more information may be found for the different parameters.

%MOD_TIME%

%MOD_TIME[<path>]%

Gets the modification time of a file in milliseconds.

The default version will get the modification time from the current file in scope. The alternative is to pass a file path as parameter which will get the modification time of that file.

%MP3_ALBUM%

If the object being handled contains ID3 tags the value from the album tag is returned.

%MP3_ARTIST%

If the object being handled contains ID3 tags the value from the artist tag is returned.

%MP3_COMMENT%

If the object being handled contains ID3 tags the value from the comment tag is returned.

%MP3_GENRE%

If the object being handled contains ID3 tags the value from the genre tag is returned.

%MP3_TITLE%

If the object being handled contains ID3 tags the value from the title tag is returned.

%MP3_TRACK%

If the object being handled contains ID3 tags the value from the track tag is returned.

%MP3_TRACKCOUNT%

If the object being handled contains ID3 tags the value from the track count tag is returned.

%MP3_YEAR%

If the object being handled contains ID3 tags the value from the year tag is returned.

%NR[<text>]%

The returned value is <text> where each carriage return and line feed is removed. The carriage return is replaced with a space character if there is no space preceeding the carriage return. This means that even if there are multiple carriage returns immediately following eachother in the original text, they will only be replaced by maximum one space character.

%PF%

Note that this macro is only useful in the context where a file is referred.

This macro is similar to the F macro but the name is taken from the parent folder. All variants of the macro that are applicable to the F macro are also available to this macro.

%REPLACE_ALL[<s>,<source>,<target>]%

Returns a modified version of <s> where all the occurancies of <source> are replaced with <target>.

Regular expression

<source> is a regular expression so use this macro with care. Make sure you are
familliar with regular expressions in Java before using this macro.

%SET_BUCKET[<key>,<value>]%

%SET_BUCKET[<type>,<key>,<value>]%

type may be "object", "workflow" or "system" (“object” is default, ie the macro variant without type means that "object" is used as type.)
key is the "key", and value is the "value". This macro will then set a bucket-value (similar to a bucket-action)

%SEPARATE[<name>,<text>,<delimiter(s)>,<handling>]%

This macro will separate a source text (the source must be structured with one or more delimiters).


Parameters:
name The name is useful if multiple separations will be handled within each other, the name will be an identifier for this particular separation process. See other separation macros where the name may be used as a parameter, for example %SEPROWNUM[name]%
text The source text that is being separated
delimiter(s) One or more (if more, separate with commas) delimiters that will be used to separate the text.
handling This will be the handling for each of the separated values.

%SEPARATE_BY_ROW[<firstRowHeader>,<name>,<text>,<delimiter(s)>,<handling>]%

Very similar to %SEPARATE[…]% but this macro will work with multiple rows. Each handling will take place on each row and column and macros such as %SEPROWNUM% may be used.


Parameters:
firstRowHeader This value should be 'true' if the first row in the text will be taken as the header row. The header values may be used in other macros in the handling, for example %SEPHEADER%
name The name is useful if multiple separations will be handled within each other, the name will be an identifier for this particular separation process. See other separation macros where the name may be used as a parameter, for example %SEPROWNUM[name]%
text The source text that is being separated
delimiter(s) One or more (if more, separate with commas) delimiters that will be used to separate the text.
handling This will be the handling for each of the separated values.

%SEPROWNUM%
%SEPROWNUM[<name>]%

This macro will return the current row number (the first row has row number 1). This is only useful when present within the handling of %SEPARATE_BY_ROW[…]% or %CSV_PARSE_ROWS[…]%.
If the separation macros are nested the name parameter may be used to get the data from that specifically named separation.

%SEPCOLNUM%
%SEPCOLNUM[<name>]%

This macro will return the current column number (the first column has column number 1). This is only useful when present within the handling of %SEPARATE_BY_ROW[…]% or %CSV_PARSE_ROWS[…]%.
If the separation macros are nested the name parameter may be used to get the data from that specifically named separation.

%SEPVALUE%
%SEPVALUE[<name>]%

This macro will return the current value in the scope.. This is only useful when present within the handling of %SEPARATE_BY_ROW[…]% or %CSV_PARSE_ROWS[…]%.
If the separation macros are nested the name parameter may be used to get the data from that specifically named separation.

%SEPHEADER%

%SEPHEADER[<column index>]%

%SEPHEADER[<name>,<column index>]%

This macro will return a header value (the name of the header if headers are present). Using the macro without parameters will return the current column's header value.
If the parameter column index is present, the header for that particular column's (the columns are numbered started from 1) header will be returned. If the separation macros are nested the name parameter may be used to get the data from that specifically named separation.

%SEPROWVALUE_BY_COL[<column index>]%

%SEPROWVALUE_BY_COL[<name>,<column index>]%

This macro is similar to %SEPVALUE[…]% but this macro will return the value of any given column index at the current row. This macro may be useful if the handling of the current column is dependent of another value in the same row.


Parameters:
column index The index of the column which value is wanted. The column index starts at 1.
name The name is useful if this macro is used within nested SEPARATE macros. In such an environment the name will be an identifier for which separation row the value is wanted for.

%SEPROWVALUE_BY_HEADER[<header>]%

%SEPROWVALUE_BY_HEADER[<name>,<header>]%

This macro is similar to %SEPVALUE[…]% but this macro will return the value of any given header at the current row. This macro may be useful if the handling of the current column is dependent of another value in the same row.


Parameters:
header The name of the header of the column which value is wanted.
name The name is useful if this macro is used within nested SEPARATE macros. In such an environment the name will be an identifier for which separation row the value is wanted for.

%SFN[<text>]%

Safe File Name - This will return the <text> where all occurancies of the following characters are replaced with underscore (_);

Character Character name
? Question mark
" Double quotes
! Exclamation mark
& Ampersand
/ Forward slash
\ Backward slash
: Colon
. Dot. Only if the name is starting with a dot that particular dot is replaced as well, other dots within the file name are not replaced.

%SOURCE_FILE_EXISTS[<path>]%

This macro may be used to check if a certain file exists. The macro will use the specific source in the scoop of the macro to find the file. If this source is a FTP source the FTP server will be checked for the file wanted.

Compared to the macro %FILE_EXISTS[...]%, this macro may also be used in a FTP source context to check if a certain file exists on the FTP server.

%SOURCE_FOLDER_FILE_COUNT[<path>]%

This macro will check a certain folder found on the source, count all the files in that folder and return the count.

The result is the number of non-hidden files (excluding folders) found directly in the folder. The macro will use the specific source in the scoop of the macro to find the file. If this source is a FTP source the FTP server will be checked for the file wanted.

Compared to the macro %FOLDER_FILE_COUNT[...]%, this macro may also be used in a FTP source context to get the count from the FTP server.

%SOURCE_NAME%

The name of the source which is the invoking source of the object in the current context where the macro is evaluated.

%Workflow_BUCKET[<key>]%

Gets a value from the current Workflow's bucket. Teh Workflow bucket is a static bucket which holds information that will remain in the Workflow as long as the Workflow exists. This bucket is different than the object bucket which is used with the macro %BUCKET[...]%.

Read more about the different buckets in chapter 2.

%Workflow_NAME%

The name of the Workflow within which context the macro is evaluated.

%STRIP[<text>]%

Special macro that will replace all characters except the ones in the list below with a underscore (_)

Characters that will remain unchanged are:

. (dot)

- (dash)

_ (underscore)

0-9 (numbers)

a-z (character a to z)

A-Z (character A to Z)

%SUBSTRING[<s>,<start>,<end>]%

Returns a portion of the soruce string <s>. The portion is taken from index <start> (included) and ends at index <end> (not included). If <end> is missing the rest of the string is taken from the start. If <start> is missing the substring will be taken from the start. The index are zero-based meaning that the first character in <s> is having number 0.

Note that if <start> and/or <end> is left out the commas still need to be present.

%SXML[<text>]%

Returns a modified version of <text>. The return value is specialized to fit in XML documents where characters are replaced with entities, e.g. 'å' is replaced with '&aring;'. Characters with UTF character number more than 128 are replaced with the entity '&#<no>;' where <no> represents the UTF value of the character.

The string <text> may contain macros.

%TRIM[<text>]%

The result from this macro is the text parameter without any space characters before and after the actual text. Space characters that will be removed includes space, tab, carriage return and line feed.

%TEXT_CONTENT[TEXT_CONTENT[…]%

This new macro is adopted to our macro version 2 where all the parameters inside the brackets are either indexed or named.

If you use the naming convention you may put the parameters in any order as long as you name them (name=value).

For example the TEXT_CONTENT macro has a parameter named format so you may write the macro

%TEXT_CONTENT[format=text,…]%


The possible parameters for TEXT_CONTENT are;

• input
Defaults to the current file in scope

• format
Can be either 'text' or 'html' (without the quotes). Defaults to text.

• output
Optional path to an output file to write to. If this parameter is present the macro itself will not return anything but the result will be written to the output file.
If this parameter is not present, the macro will return the result text (for example if the macro is used in a text file action, you do not want to use this output parameter but you want the output in the text where the macro is present).

• output_encoding
Optional if the output parameter is present to specify the output text encoding,. Defaults to UTF-8

• output_append
Only if output parameter is present, this may be 'true' or 'false'. Defaults to 'false'. If true the output will be appended with this new result.

%UPPER[<text>]%

The returned value is <text> where each character is in upper case in the returned value.

%UUID%

The returned value is a unique ID.

%XMP[<xmpID>]%
%XMP[<xmpID>, filePath]%

The XMP data from the file isread and the value from the specified xmpID is returned.

The xmpID is an identifier which is unique for each XMP data. The default XMP data fields' identifiers may be seen as tooltip in the special XMP popup menues that are available in the setup. Customized XMP data has their own identifier specified when created chosen by the user. The xmpID is the XMP prefix followed by a colon and then the property field name, e.g. tiff:Compression

The value returned is always a string representation even if the value may be a date or another object.

If no filePath parameter is given, the file currently in scope of the macro will be read, otherwise the file given by the filePath.

%XPATH[string, xpath expression,prefix=URI,prefix=URI,...]%

This macro will calculate an XPath expression from the given string (XML format). The returned result is a string representing the result of the XPath expression.

The parameter string is the XML string on which the XPath expression will be calculated.

Only the string and xpath expression parameters are compulsory, the rest of the parameters are optional and if exists they should all have the following structure: prefix=URI. These parameters are used to identify namespaces in the XML string, the prefix is the namespace prefix and the URI is the namespace URI. For example the IPTC core namespace would have the following value: Iptc4xmpCore=http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/

For more information about valid XPath expressions, see http://docs.oracle.com/javase/tutorial/jaxp/xslt/xpath.html

%XPATHEL[string, xpath expression,prefix=URI,prefix=URI,...]%

Very similar to the XPATH macro. The result from this XPath expression will be taken as a node value and the result will be this node as XML compared to the XPATH macro which will force the result to a string value.

The parameters are the same as the XPATH macro.

For more information about valid XPath expressions, see http://docs.oracle.com/javase/tutorial/jaxp/xslt/xpath.html

%XPATHLIST[string, xpath expression, bucket key, prefix=URI,prefix=URI,...]%

This macro will calculate an XPath expression from the given string (XML format). The returned result is a list of values and will be saved in the current bucket with the given bucket key.

The parameter string is the XML string on which the XPath expression will be calculated.

Only the string, xpath expression and bucket key parameters are compulsory, the rest of the parameters are optional and if exists they should all have the following structure: prefix=URI. These parameters are used to identify namespaces in the XML string, the prefix is the namespace prefix and the URI is the namespace URI. For example the IPTC core namespace would have the following value: Iptc4xmpCore=http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/

The list which is placed in the bucket key may be used in other special macros handling lists, e.g. %BUCKET_LIST[...]%.

For more information about valid XPath expressions, see http://docs.oracle.com/javase/tutorial/jaxp/xslt/xpath.html

%ZIPF%

Note that this macro is only useful in the context where a zip file is referred.

This macro is similar to the F macro but the name is taken from the zip file (e.g. in the unzip action where %F% will give the unzipped file name but %ZIPF% will give the original zipped file name). All variants of the macro that are applicable to the F macro are also available to this macro.

%SYSTEM_BUCKET[key]%

This will get the value from the system bucket named 'key'

%DATE_CHANGE[date,format,unit,amount,resultFormat]%

date: original date / time to expire, eg 2017-12-13
format: The format that 'date' has, like yyyy-MM-dd, see% D% for all formats
unit: one of the following: 'day', 'hour', 'minute' or 'second'
amount: number of 'unit' to be added or deducted
resultFormat: The format you want for the final date / time
ex% DATE_CHANGE [2017-12-13, yyyy-MM-dd, day, 11, dd / MM-yyyy]% will give '24 / 12-2017 '

%JSON[json,wanted]%

Parses a Json text to get a property. json: A json formatted text wanted: the wanted property from the json

%REMOVE_BOM[text]%

This will remove any Byte Order Mark (BOM) character from the 'text' parameter.

%SFN2[text,replacement]%

Replaces the 'text' parameter with 'replacement' where there is a character not suitable for a file name. The following characters are removed:
All characters with ASCII code <32
char 34 (")
char 38 (& )
char 39 (')
char 42 (* )
char 47 (/)
char 58 (: )
char 59 (; )
char 60 (<)
char 62 (>)
char 63 (?)
char 92 (\)
char 124 (|)
any char between 57344 and 63743
char 65533 (unicode replacement character)
+ any other character that is undefined

Note that if replacement is missing, the default replacement will be empty (ie. the illegal characters will be removed and not have any replacement character).

%URL_ENCODE[text]%

Translates 'text' into application/x-www-form-urlencoded format. Any '+' characters will also be encoded to '%20'

%XPATHLISTEL[string, xpath expression,bucketKey,prefix=URI,prefix=URI,...]%

Very similar to XPATHLIST. The result bucketKey will be populated with a list instead of text. So using list macros after this macro is possible, for example BUCKET_LIST.