Macros in Photo Supreme
Generic Macro Parameters
As mentioned earlier, Macro Parameters allow you to control the output of a Macro Command. Here’s a list of all the generic parameters you can utilize:
Parameter
| Values | Description | Example(s) |
|---|---|---|---|
Left | n [Integer] ellipsis [Constant] | This will return the left [n] characters of the parsed value
Use the optional "ellipsis" constant to add a trailing "..." leader when the result is truncated.
| %FileName{left=5} %ImageDescription{left=30,ellipsis} |
Right | n [Integer] ellipsis [Constant] | This will return the right [n] characters of the parsed value
Use the optional "ellipsis" constant to add a leading "..." leader when the result is truncated.
| %xmp:dc:title{right=20} %ImageDescription{right=60,ellipsis} |
Mid | s [Integer] n [Integer] ellipsis [Constant] | This will return [n] characters of the parsed value, starting at position [s] The “length [n]” value is optional, if omitted then the substring starting from position [s] to the end of the parsed value is returned.
Use the optional "ellipsis" constant to add a trailing or leading "..." indicator when the result is truncated at the end or at the beginning.
| %FileName{mid=4,10} %FilePath{mid=7} |
Extract | From [string] To [string] | This will return all characters of the parsed value, between the From text and the To text
Use the optional "ellipsis" constant to add a trailing or leading "..." indicator when the result is truncated at the end or at the beginning.
| %FileName{extract=IMG_,_} This returns the text in the filename between IMG_ and the subsequent underscore. e.g. IMG_12345_20200523.JPG then returns 12345 |
Delete | s [Integer] n [Integer] | This will delete [n] characters of the parsed value, starting at position [s]
| %FileName{delete=2,4} |
Padd | n [Integer] c [Char] left [Constant] | This will return parsed value, padded to a specific length [n] using a specific character [c]. By default the value is padded to the right. Optionally add the left constant to pad to the left instead of to the right.
| %xmp:dc:title{padd=50,x,left} %xmp:dc:title{padd=50, } |
PathDelimiter | y [Constant] n [Constant] | This will add or remove a trailing path delimiter at the end of the string Note: the delimiter used is platform dependent. On Windows this is a backslash while on MacOS this is a forward slash. | %FilePath{pathdelimiter=y} This will return the file’s path with a trailing path delimiter. |
Uppercase | y [Constant] | This will return the value in uppercase characters
| %FileName{uppercase=Y} |
Lowercase | y [Constant] | This will return the value in lowercase characters
| %FileName{lowercase=Y} |
Encode | Encoding [String] | Return an encoded string for a particular scheme. Possible values are: HTML (convert html specific tags to codes) URL (convert non url characters to codes) QUOTES (convert quotes to double quotes) ESCAPE (convert non-standard ascii characters) UTF8 (convert the text to UTF8 format) | %FileName{encode=HTML} |
Decode | Decoding [String] | Return a decoded string for a particular scheme. Possible values are: HTML URL UTF8 | %FileName{decode=UTF8} |
InitCaps | Y [Constant] | This will return the value in “initial capital” format, meaning that the first character of each word is capitalized and the rest of the letters in the words are lowercase. | %xmp:dc:title{initcaps=y} |
Reverse | y [Constant] | This will return the reversed string of the parsed value
| %FileName{reverse=y} |
Replace | sub [String] replacement [String] CaseSensitive [Constant] FirstOnly [Constant] | This will replace a specific sub string [sub] with a replacement string [replacement].
By default, all occurrences of [sub] will be replaced, regardless the case and regardless of the number of occurrences.
Optionally specify if the replacement should be case sensitive [CaseSensitive]
Optionally specify if only the first occurrence should be replaced [FirstOnly] (default = all)
| %xmp:dc:description{replace=Canon,Nikon} %xmp:dc:description{replace=Canon,Nikon,CaseSensitive} %xmp:dc:description{replace=Canon,Nikon,CaseSensitive,FirstOnly} |
Trim | y [Constant] | This will return the parsed value without leading and trailing spaces
| %FileName{trim=y} |
Empty | s [String] | This will return the specified string [s] when the parsed value returns an empty value
| %xmp:dc:description{empty=(no description)} %xmp:dc:description{trim=y;empty=-none-} |
Wrap | n [Integer] | This will wrap the parsed value to a specific number [n] of characters per line
| %xmp:dc:description{wrap=30} |
Trunc | n [Integer] left [Constant] | This will break the parsed value at a specific length [n] and if the value is longer than [n] then the value is presented with a trailing or leading... truncating identifier
Optionally you can use the [left] constant to define that the string should be truncated at the left instead of the default right
| %FileName{trunc=15} %FileName{trunc=15,left} |
Word | n [Integer] right [Constant] separator [Constant] | This will return the [n]'th word of the parsed value.
You can specify the constant [right] to return the [n]'th word, starting from the right instead of from the left
By default the space character is used as the separator to tokenize the parsed value to words. Optionally specify a different [separator] as the third parameter. | %exif:Model{word=2} %exif:Model(word=3,right} %FileDirectoryName(word=1,right,\} |
DateFormat | format [String] | Return a date string in a different format, based on date formatting settings. The input date string should either be an ISO Date String (yyyy-mm-ddThh:nn:ss+zz:zz) or in an Exif date format (yyyy:mm:dd hh:nn:ss) or in the format that is configured in Windows.
The format is a Delphi date formatting string. Date-Time Format Strings specify the formatting of date-time values when they are converted to strings.
Also see: http://www.delphibasics.co.uk/RTL.asp?Name=FormatDateTime
| Here's a sample to extract the year and month part of the photo date of an image: %ImagePhotoDate{dateformat=yyyy-mm} |
Format | format [String] | Return a number string in a different format, based on number formatting settings. The input number string should either be an ISO Number String (+number.fraction) or in the format that is configured in Windows.
The format is a Delphi number formatting string. Format specifiers have the following form:
"%" [index ":"] ["-"] [width] ["." prec] type
A format specifier begins with a % character. After the % come the following, in this order:
An optional argument zero-offset index specifier (that is, the first item has index 0), [index ":"] An optional left justification indicator, ["-"] An optional width specifier, [width] An optional precision specifier, ["." prec] The conversion type character, type
Also see: http://www.delphibasics.co.uk/RTL.asp?Name=Format
| This will list the aperture value with a precision of 5 decimals %exif:FNumber{mid=2,100;format=%8.5f} |