Variable List

Predefined expressions

You can use expression evaluation in p7mTool switches to simplify script's design. p7mTool defines some built-in expressions but you can also define your own variables using --Define switch.

Built-in expressions

ARCHNAME Current date and time as a string composed of two numbers separated with an underscore. The first number identifies the day and the second number identifies the time of the day with accuracy of 50 ms.
If now it is 01 Jul 2004, 13:07:45, then ${TIME} will evaluate to 38169_5470573148
ARCHNAMEBASE  A suggested name of the archive generated basing on the files given in --FileList switch. If there is no --FileList value, then the name suggested will be smime.p7m. If there is only one value of --FileList, will be that value with ".p7m" appended If there are more values of --FileList, then the name suggested will be either the "greatest common directory" directory in which they are eventually located or the name of the first file, with .p7m appended in both cases. Other special rules are used, when the filelist consists only of a root directory, like c:\ or in some other cases.
if --FileList has value c:\dir1\dir2\file.txt then ${ARCHNAME} is evaluated to c:\dir1\dir2\file.txt.p7m.
ARCHPATH Current date and time as a string composed of two numbers separated with an underscore. The first number identifies the day and the second number identifies the time of the day with accuracy of 50 ms.
If now it is 01 Jul 2004, 13:07:45, then ${TIME} will evaluate to 38169_5470573148
ENV(envvarname)  Returns the value of the environment variable of name envvarname.
p7mtool -if${ENV(WINDIR)} -of${ENV(TEMP)}\windir.p7m p7mTool will archive all the files in %WINDIR% and store them in %TEMP%\windir.p7m, without any security imposed.
FLATTEN(path) Flattens the path given by replacing colons, spaces, slashes and back slashes with underscores. This may be useful when genererating file names based on a full path.
if %ArchiveDir% is a environment variable pointing to c:\archives p7mtool --Define "Dir=c:\path 1\path 2" --FileList "${Dir}" --OutputFile %ArchiveDir%\${FLATTEN(${Dir})}.p7m output file name would evaluate to c:\archives\c__path_1_path_2.p7m
HTMLCONTENT  The first value of --HtmlContent switch. If no --HtmlContent switch is present and there is a text content specified using --Content switch, html content will be generated basing on the text content.
P7MTOOL.VERSION Product version of the running p7mTool instance.
${P7MTOOL.VERSION} could evaluate to 1.15.10.145
READ(filename,encoding) Returns the UNICODE content of the file specified by filename, assuming that the file has been encoded using encoding. Acceptable encodings now are: ISO-8859-x ( x in 1..16) and UTF-8.
if %ArchiveDir% is a environment variable pointing to c:\archives p7mtool -ct${Read(c:\content\Polish.content.txt,ISO-8859-2)} -hd -ofpolish.eml p7mTool will read the content of c:\content\Polish.content.txt convert it to unicode, assuming that it has been encoded in ISO-8859-2, and place that content into polish.eml with proper headers. Note that the encoding of the output file is always UTF-8.
SMTPDATE Current date and time in the syntax described in RFC 822 that can be used to set the value of Date header in smtp files.
When it is 01 Jul 2004, 13:28:16 in Poland ${SMTPDATE} will evaluate to Thu, 01 Jul 2004 13:28:16 +0200
--<SwitchName>(index)  Returns the index-th value of the switch named . The first value has index of 1.
p7mtool --ExportCert ECA29B3F1F7C09EBD4103B51760992C7FDC78672 --OutputFile ${--ExportCert(1)}.cer p7mTool will archive all the files in %WINDIR% and store them in %TEMP%\windir.p7m, without any security imposed.
TIME.DD Current date's day as two digit text
if today it is 20 May 2004, then ${TIME.DD} evaluates to 20
TIME.HH Current time's hours as two digit text
if it is 15:20:14 nor, then ${TIME.HH} evaluates to 15
TIME.MM Current date's month as two digit text
If today it is 20 May 2004, then ${TIME.MM} evaluates to 05
TIME.NN Current time's minutes as two digit text
if it is 15:20:14 nor, then ${TIME.NN} evaluates to 20
TIME.SS Current time's seconds as two digit text
if it is 15:20:14 nor, then ${TIME.SS} evaluates to 14
TIME.YYYY Current date's year as four digit text
Example: if today it is 20 May 2004, then ${TIME.YYYY} evaluates to 2004
TIME Current date and time as a string composed of two numbers separated with an underscore. The first number identifies the day and the second number identifies the time of the day with accuracy of 50 ms.
If now it is 01 Jul 2004, 13:07:45, then ${TIME} will evaluate to 38169_5470573148
UNIQUENAME(string) Generates a "unique" name based on the value supplied. The name consists of the value with two random strings appended. The name is not guaranteed to be unique in any context, but when string is itself a "unique" name, the outcome should be sufficient in most applications. An example of "sufficiently unique" string is . Moreover, you can iterate UNIQUENAME operation, eg. to "increase the uniquity" of the value.
p7mtool --FileList c:\archived_directory --OutputFile c:\outbox\${UNIQUENAME(${TIME})}.p7m on 1 Jul 2004, 13:07:45 the output file name could evaluate to c:\outbox\38169_5470573148_7E320AA0_190D.p7m
UNIQUENAME Equivalent to .
On 1 Jul 2004, 13:07:45 ${UNIQUENAME} could evaluate to c:\outbox\38169_5470573148_7E320AA0_190D.p7m
Uxxxx A unicode character with index xxxx in hexadecimal representation.
${U000D}${U000A} will evaluated to \n\r, in C convention. ${U03B1} will evaluate to Greek letter alpha p7mtool -of${U03B1}${U03B2}${U03B3}${U03B4}.p7m
x.NAME Name of the file with index x in the value list of --FileList switch, with the first value having index 1. Name part is the last part of the path, without drive and directory parts.
p7mtool -fl file1.txt -fl file2.txt;file3.txt c:\dir1\dir2\ ${1.NAME} evaluates to file1.txt ${4.NAME} evaluates to c:\dir1\dir2
x.NAMEBASE  Namebase of the file with index x in the value list of --FileList switch, with the first value having index 1. Name part is the last part of the path, without drive and directory parts.
p7mtool -fl file1.txt -fl file2.txt;file3.txt c:\dir1\dir2\ ${1.NAMEBASE} evaluates to file1 ${4.NAMEBASE} evaluates to dir2
x.PATH  Path of the file with index x in the value list of --FileList switch, with the first value having index 1.
p7mtool -fl file1.txt -fl file2.txt;file3.txt c:\dir1\dir2\ ${1.PATH} evaluates to file1.txt ${4.PATH} evaluates to c:\dir1\dir2\
Copyright © Cryptigo 2001-2013Last modified on  09 Jul 2004