The Bat! Help

Folders (6)
Macros (13)
Backup (4)

XMP macros

  • Operating system
  • Files and folders
  • Date and time
  • Dialogs and Messages
  • IDN International Domains
  • Messages and header
  • Strings
  • Strings
  • Other

  • Operating system

    Macro Description
    %XMP_Beep(Frequency, Duration) Outputs a tone with the specified "Frequency" and "Duration". The "Frequency" attribute must be in the range of 37 to 32,767. "Duration" specifies the length of the tone in milliseconds.
    Example:
    %XMP_Beep(300,300)%
    %XMP_Beep(200,150)%
    %XMP_Beep(100,400)%
    %XMP_Envir(EnvironmentVariable) Outputs the value of the specified "EnvironmentVariable". In the console, you can get a list of all available environment variables using the command SET
    Example:
    XMP_Envir("OS")
    XMP_Envir("WinDir")
    Output:
    Windows_NT
    C:\WINNT
    %XMP_Host2IP([Hostname]) Returns the IP address for the specified "Hostname". If no "Hostname" is provided, the IP address of the local machine is returned. A network or internet connection may be required. If the host cannot be found, the template may briefly pause (approx. 2 seconds).
    Example:
    %XMP_Host2IP
    %XMP_Host2IP("gaijin1")
    %XMP_Host2IP("gaijin2")
    Output:
    192.168.1.1
    192.168.1.1
    192.168.1.2
    %XMP_IsUserAdmin This macro returns the value "1" if the current user has administrator rights; otherwise, it returns "0".
    %XMP_KbdLayout([Layout]) Retrieves or sets the current keyboard layout. If no Layout parameter is provided, the current keyboard layout is returned. If Layout is specified, the keyboard layout is set; in the case of success, the return value is an empty string.
    The keyboard layout remains set throughout the entire session with The Bat!
    The Layout is generally expected to be a hexadecimal value, where leading zeros can be omitted. The return value is always an 8-digit hexadecimal number.
    Instead of a hexadecimal value, a language abbreviation can also be used. All abbreviations defined by Microsoft are supported. To make it easier to select the keyboard layout, alias names are also supported — these are usually associated with languages rather than keyboard layouts. This includes all language abbreviations used by The Bat! as well as some commonly used ones, such as "de" for German or "en" for English. The full list can be found in the "Language IDs" appendix.
    Example:
    Layout: %XMP_KbdLayout
    %XMP_KbdLayout("409")%
    Layout: %XMP_KbdLayout
    Output (with test input):
    Test äöüÄÖÜ
    Layout: 00000407
    Layout: 00000409
    Test ';[":{
    %XMP_Process("E", Process)
    %XMP_Process("L", [Delimiter])
    Displays a list of all running processes.
    The first parameter must be either "E" or "L".
    The "E" option checks if the specified Process is currently running. If the process name is found, it returns "1", otherwise "0". The check is case-insensitive, but the full process name must be provided. The file extension ".EXE" can be omitted.
    If "L" is specified as the first parameter, a list of all running process names is returned. The optional Delimiter argument defines the separator used between process names. By default, a Windows line break is used.
    Example:
    %XMP_Process("L")
    %XMP_Process("L","|")
    %XMP_Process("E","TheBat.exe")
    Layout: %XMP_KbdLayout
    Output (short):
    [IDLE]
    System
    SMSS.EXE
    CSRSS.EXE
    WINLOGON.EXE
    thebat.exe
    [IDLE]|System|SMSS.EXE|CSRSS.EXE|WINLOGON.EXE|...|thebat.exe
    %XMP_RegGet(Key, [Default]) Reads a value from the Windows Registry.
    The Key must be specified in the format: "ROOT\Key\Entry"
    Both short and full forms of the root key are supported:
    CR HKEY_CLASSES_ROOT
    CU HKEY_CURRENT_USER
    LM HKEY_LOCAL_MACHINE
    US HKEY_USERS
    PD HKEY_PERFORMANCE_DATA
    CC HKEY_CURRENT_CONFIG
    DD HKEY_DYN_DATA
    The optional "Default" parameter specifies the text to be returned in case of an error, e.g., when the entry does not exist.
    You can read Strings, Expanded Strings, Multi-Strings, and DWord values (up to 0xFFFFFFFF).
    Example:
    %XMP_RegGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows %-
    NT\CurrentVersion\ProductName")
    %XMP_RegGet("LM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
    %XMP_RegGet("LM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate")
    Output:
    Microsoft Windows 2000
    Microsoft Windows 2000
    1022448564
    %XMP_RegSet(Key, [Value], [Format]) Writes a "Value" to the Windows Registry.
    The "Key" must be specified in the format: "ROOT\Key\Entry"
    Both short and full forms of the root key are supported:
    CR HKEY_CLASSES_ROOT
    CU HKEY_CURRENT_USER
    LM HKEY_LOCAL_MACHINE
    US HKEY_USERS
    PD HKEY_PERFORMANCE_DATA
    CC HKEY_CURRENT_CONFIG
    DD HKEY_DYN_DATA
    The optional "Format" parameter specifies the data type to be used. The default is "S" for String. Valid formats are:
    S String
    E Expanded-String
    M Multi-String
    D DWord
    Example:
    %XMP_RegSet("CU\Test\TestString","Hallo")
    %XMP_RegSet("CU\Test\TestDWord","123","D")
    If the value is written successfully, the macro returns "1"; otherwise, it returns "0".
    %XMP_Run(Program, [Window]) Executes the specified Windows Program.
    The optional "Window" parameter defines the window state. Valid values are:
    MIN -> minimized window
    MAX -> maximized window
    HIDE -> hidden window
    If "Window" is not specified, the program is launched in its normal window size.
    Example:
    %XMP_Run("calc")
    %XMP_Run("explorer","max")
    %XMP_RunCmd(Command, [NoConvert], [Timeout]) Executes the specified console "Command" and returns the output as the result. Path names must be provided in DOS format (with "8.3" filenames)!
    If "NoConvert" is set to "1", the output will not be converted to ANSI format. This can be useful if the program already outputs data in ANSI format.
    The "Timeout" specifies the maximum wait time in milliseconds before the execution is aborted. The default value is 5000 milliseconds (5 seconds). However, this value can be set much higher, for example, when compressing or decompressing a file.
    Example:
    %XMP_RunCmd("ver")
    Output:
    Microsoft Windows 2000 [Version 5.00.2195]
    %XMP_SetClipB(Text) Saves the text specified under "Text" to the Windows clipboard. The internal macro of The Bat! — "%CLIPBOARD" — can be used to read the clipboard content.
    Example:
    %XMP_SetClipB("Hello")
    The XMP_SetClipB macro does not return a value.
    %XMP_SendKeys(Keys, [Wait]) Sends the specified "Keys" or key combinations to the active application. In the case of a Quick Template, this would be the message editor.
    If the macro is used in other types of templates (e.g., a filter), it may lead to unintended results!
    The optional "Wait" parameter accepts the values "1" or "0" and determines whether the macro should wait for the key input to be processed ("1" = wait).
    The "Keys" parameter uses the following syntax (similar to VB’s SendKeys):
    + -> Shift
    ^ -> Control
    % -> Alt
    ~ -> Return (Enter)
    ( and ) -> Grouping of keys
    { and } -> Indicate key names
    You can group multiple keys with parentheses: +ab means "Shift+a, b", +(ab) means "Shift+a, Shift+b"
    Key names such as "BACKSPACE" must be enclosed in curly braces. Valid key names include: BKSP, BS, BACKSPACE, BREAK, CAPSLOCK, CLEAR, DEL, DELETE, DOWN, END, ENTER, ESC, ESCAPE, F1–F16, HELP, HOME, INS, LEFT, NUMLOCK, PGDN, PGUP, PRTSC, RIGHT, SCROLLLOCK, TAB, UP

    Text in the editor:
    Hello,
    Test
    Example:
    %XMP_SendKeys("^(ac{END})",1)
    %XMP_QuoteAdd("%CLIPBOARD")%-
    Output:
    Hello
    Test
    > Hello
    > Test
    %XMP_SysInfo(Text) Retrieves system information and replaces specific tags in the "Text" with the corresponding values.
    The following tags are recognized:
    $clv$ -> CPU processor level
    $cmn$ -> CPU model
    $cnr$ -> Number of CPUs
    $cns$ -> CPU name
    $csp$ -> CPU speed
    $ctp$ -> CPU type
    $cvn$ -> CPU manufacturer
    $lhn$ -> Local hostname
    $lip$ -> Local IP address
    $maf$ -> Available size of the page file (MB)
    $map$ -> Available physical memory (MB)
    $mav$ -> Available virtual memory (MB)
    $mml$ -> Memory load (percent)
    $mtf$ -> Maximum size of the page file (MB)
    $mtp$ -> Total physical memory (MB)
    $mtv$ -> Total virtual memory (MB)
    $osp$ -> Platform
    $pcn$ -> Computer name
    $sed$ -> System uptime in days
    $seh$ -> System uptime in hours
    $sen$ -> System uptime in minutes
    $ses$ -> System uptime in seconds
    $suh$ -> Uptime (hours only)
    $sun$ -> Uptime (minutes only)
    $sus$ -> Uptime (seconds only)
    $tdn$ -> Name of daylight saving time for current time zone
    $tsn$ -> Name of standard time for current time zone
    $tzn$ -> Name of current time zone
    $usn$ -> Username
    $wcn$ -> Operating system name
    $wvm$ -> OS major version
    $wvs$ -> OS minor version
    $wvb$ -> OS build number
    $wvc$ -> OS CSD version
    Example:
    %XMP_SysInfo("Windows $wcn$ ($osp$ $wvm$.$wvs$%-
    Build $wvb$ - $wvc$)"
    %XMP_SysInfo("CPU: $cvn$ $cmn$ ($ctp$)")
    ---
    System uptime: %XMP_SysInfo("$sen$ Minuten")
    (%XMP_SysInfo("$sed$ Tage, $suh$ hours, $sun$ %-
    minutes, $sus$ seconds."))
    Output:
    Windows 2000 (NT 5.0 Build 2195 - Service Pack 4)
    CPU: Intel Pentium 4 (586)
    ---
    System uptime: 764 minutes (0 days, 12 hours, 44 minutes, 10 seconds.)

    0  

    Files and folders

    Macro Description
    %XMP_AttrGet(filename) Retrieves the attributes of the specified file.
    The following attribute values are returned:
    R -> Read-only
    A -> Archive
    H -> Hidden
    S -> System
    D -> Directory
    If an empty string is returned, the file has no attributes. In case of an error, an asterisk ("*") is returned.
    Example:
    %XMP_AttrGet("C:\Boot.ini")
    Output:
    HS
    %XMP_AttrSet(Filename, [Attributes]) Sets the attributes of the specified file.
    The following attribute values are recognized:
    R -> Read-only
    A -> Archive
    H -> Hidden
    S -> System
    The order and case of the attributes are not important. Any characters not listed above will be ignored.
    If no attributes are specified, all attributes will be removed.
    If the attributes were successfully set, the macro returns "1"; otherwise, it returns "0".
    Example:
    %XMP_AttrSet("C:\Test.txt","HSA")
    %XMP_DirCreate(Path) Creates the specified "Path". If the path was successfully created or already exists, the value "1" is returned. If the path cannot be created, "0" is returned.
    Example:
    %_Tmp='%XMP_DirCreate("C:\Test1\TEST2\test3")'%-
    The variable "%_Tmp" contains the return value of the %XMP_DirCreate macro, which can be processed further using %IF or another macro.
    %XMP_DirExist(Directory) Checks whether a "Directory" exists. If the directory is found, it returns "1", otherwise "0".
    Example:
    %_Tmp='%XMP_DirExist("C:\Windows\System32")'%-
    The variable "%_Tmp" contains the return value of the %XMP_DirExist macro, which can be further processed with %IF or another macro.
    %XMP_FileAddLn(File, Text) Appends the lines specified in "Text" to the "File".
    The "Text" argument can include line breaks. If the file does not exist, it will be created.
    Example:
    %XMP_FileAddLn("C:\Test.txt", "%XMP_StrC('Line1\r\nLine2\r\nLine3')")
    Content of the file:
    ...
    Line1
    Line2
    Line3
    %XMP_FileCopy(Source, Destination) Copies the file(s) specified in "Source" to the "Destination" directory. If a file already exists in the destination directory, it will be overwritten without confirmation.
    If the files/folders were copied successfully, the macro returns "1", otherwise "0".
    To copy multiple files at once, file names can be separated by a pipe character ("|"). Wildcard characters ("?" and "*") are also supported.
    Example:
    %_Tmp='%XMP_FileCopy("C:\Test.txt","C:\Windows\")'%-
    The variable "%_Tmp" contains the return value of the %XMP_FileCopy macro, which can be further processed using %IF or another macro.
    %XMP_FileDel(File) Deletes the specified "File" without confirmation. If the file was successfully deleted, the macro returns "1", otherwise "0".
    To delete multiple files at once, file names can be separated by a pipe character ("|"). Wildcard characters ("?" and "*") are also supported.
    Example:
    %_Tmp='%XMP_FileDel("C:\Test.txt")'%-
    The variable "%_Tmp" contains the return value of the %XMP_FileDel macro, which can be further processed using %IF or another macro.
    %XMP_FileExist(File) Checks whether a File exists. If the file is found, the macro returns "1", otherwise "0".
    Example:
    %_Tmp='%XMP_FileExist("C:\Test.txt")'%-
    The variable "%_Tmp" contains the return value of the %XMP_FileExist macro, which can be further processed using %IF or another macro.
    %XMP_FileInfo(File, Info) Retrieves information from the VERSIONINFO block of an EXE or DLL file.
    The "Info" argument refers to the name of the stored information. There are no restrictions on the name. If the information is not found, nothing is returned.
    Examples for "Info":
    • CompanyName
    • FileDescription
    • FileVersion
    • InternalName
    • LegalCopyright
    • OriginalFilename
    • ProductName
    • ProductVersion
    In some cases, additional values may also be queried.
    %XMP_FileInUse(Filename) Indicates whether the file specified in the "Filename" parameter is currently in use. The macro returns "1" if the file is in use; otherwise, it returns "0".
    Example:
    %XMP_FileInUse("C:\InUse.txt")
    %XMP_FileInUse("C:\NotInUse.txt")
    Output:
    1
    0
    %XMP_FileLines(File, [Start], [Count], [Conversion]) Reads a certain "Count" of lines from the "File", starting at line number "Start", and returns them as the result.
    If "Start" is omitted, the first line is assumed as the start. The default value for "Count" is 1. If 0 is specified for "Count", all lines until the end of the file are returned.
    Calling the macro with only a file name will return all lines in the file.
    For the "Conversion" parameter, 1 can be specified when reading DOS files. The default is 0 for Windows files.
    Example:
    %XMP_FileLines("C:\Win.txt",2,2)
    Without conversion: %XMP_FileLines("C:\Dos.txt", 2, 1)% With conversion: %XMP_FileLines("C:\Dos.txt", 2, 1, 1)
    Output:
    2 Abc ÄäÖöÜü ß µ WIN
    3 Abc ÄäÖöÜü ß µ WIN

    Without conversion: 2 Abc Ž„™”š• á æ DOS
    With conversion: 2 Abc ÄäÖöÜü ß µ DOS
    %XMP_FileLnCnt(File) Determines the number of lines in the specified "File".
    If the file is not found, an empty string is returned.
    Example:
    Lines="%XMP_FileLnCnt('C:\boot.ini')"
    Error="%XMP_FileLnCnt('C:\boot1.ini')"
    Output:
    Lines="5"
    Error=""
    %XMP_FileLong(Filename) Retrieves the long file name from the specified short file or directory name.
    Example:
    %XMP_FileLong("C:\WINDOWS\ANWEND~1\THEBAT~1\")
    Output:
    C:\WINDOWS\Anwendungsdaten\The Bat!\
    %XMP_FileMove(Source, Destination) Moves the file(s) specified in "Source" to the "Destination" directory. If a file with the same name already exists in the destination directory, it will be overwritten without confirmation.
    If the files/folders were moved successfully, the macro returns "1", otherwise "0".
    To move multiple files at once, file names can be separated by a pipe character ("|"). Wildcard characters ("?" and "*") are also supported.
    Example:
    %_Tmp='%XMP_FileMove("C:\Test.txt","C:\Windows\")'%-
    The variable "%_Tmp" contains the return value of the %XMP_FileMove macro, which can be further processed using %IF or another macro.
    %XMP_FileName(Filename, [Part]) Returns a part of a "Filename".
    The following "Parts" can be extracted:
    N -> Filename with extension (default)
    F -> Filename without extension
    E -> File extension
    D -> Drive letter
    P -> Path including drive letter
    V -> Path without drive letter
    T -> File type description as shown in Explorer
    Example:
    %XMP_FileName("C:\Windows\Explorer.exe")
    %XMP_FileName("C:\Windows\Explorer.exe","F")
    %XMP_FileName("C:\Windows\Explorer.exe","E")
    %XMP_FileName("C:\Windows\Explorer.exe","D")
    %XMP_FileName("C:\Windows\Explorer.exe","P")
    %XMP_FileName("C:\Windows\Explorer.exe","V")
    %XMP_FileName("C:\Windows\Explorer.exe","T")
    Output:
    Explorer.exe
    Explorer
    .exe
    C:
    C:\Windows\
    \Windows\
    Application
    %XMP_FileOwner(Filename) Returns the owner of the specified file.
    Example:
    %XMP_FileOwner("C:\Boot.ini")
    %XMP_FileOwner("D:\Test.txt")
    Output:
    VORDEFINIERT\Administratoren
    NOBODY\Gaijin
    %XMP_FileShort(Filename) Retrieves the short file name (DOS filename) of the specified file or directory.
    Example:
    %XMP_FileShort("C:\WINDOWS\Anwendungsdaten\The Bat!\Vorlagen\QT_Pack")
    Output:
    C:\WINDOWS\ANWEND~1\THEBAT~1\Vorlagen\QT_Pack
    %XMP_FileSize(File, [Unit]) Retrieves the size of a "File".
    The "Unit" argument can have the following values:
    K -> Kilobyte
    M -> Megabyte
    G -> Gigabyte
    Example:
    %XMP_FileSize("C:\Test.dat","K") KB
    Output:
    321,72 KB
    %XMP_FileTime(File, DateType, [Format]) Retrieves the specified "DateType" of a "File".
    The !DateType! argument can have the following values:
    A -> Date of last access
    C -> Date and time of creation
    M -> Date and time of last modification
    If the optional "Format" argument is omitted, the date is returned in the format "dd.mm.yyyy hh:nn:ss", or in case of last access, "dd.mm.yyyy".
    The format strings correspond to those used by The Bat!Example:
    %XMP_FileTime("C:\Test.txt","C","mm/dd/yyyy, hh:nn)
    %XMP_FileTime("C:\Test.txt","M")
    Output:
    08/15/2025, 17:27
    15.08.2025 18:02:29
    %XMP_GetPath(Path) Retrieves the directory identified by "Path".
    The following named "Paths" are available:
    TBWork -> The Bat! working directory
    WinDir -> Windows directory
    SysDir -> System directory
    MyDesktop -> Desktop directory of the current user
    MyFiles -> "My Documents" directory of the current user
    MyRecent -> Recently used files of the current user
    MyTemp -> Temporary directory of the current user
    Additionally, all names of the "Shell Folders" from the registry can be used. For example, paths like "AppData", "Local Settings", and "Local AppData" are included here.
    Example:
    %XMP_GetPath("TBWork")
    %XMP_GetPath("MyTemp")
    %XMP_GetPath("WinDir")
    %XMP_GetPath("MyFiles")
    %XMP_GetPath("Local Settings")
    Output:
    C:\Documents and Settings\Gaijin\Application Data\The Bat!\
    C:\Documents and Settings\Gaijin\Local Settings\Temp\
    C:\WINNT\
    C:\Documents and Settings\Gaijin\My Documents\
    C:\Documents and Settings\Gaijin\Local Settings\
    %XMP_IniGet(File, Section, Key, [Default]) Reads a value from an INI file. If an error occurs, or the value is empty or not found, the value specified under "Default" is returned.
    If "Default" is not specified, an empty string is assumed.
    The maximum size of the data to be read is 10 KB.
    Example:
    %XMP_IniGet("C:\Test.ini","Settings","Path")
    %XMP_IniSet(File, Section, Key, Value) Writes a "Value" to an INI file. If the value is successfully written, nothing is returned. In case of an error, the error message ' *** Action not successful *** ' is output.
    Example:
    %XMP_IniSet("C:\Test.ini","Settings","Path","C:\Test\")
    %XMP_TempDir Retrieves the temporary directory of the operating system.
    Example:
    %XMP_TempDir
    Output:
    C:\DOKUME~1\Gaijin\LOKALE~1\Temp\
    %XMP_TempFile Retrieves a free filename for a temporary file.
    Example:
    %XMP_TempFile
    Output:
    C:\DOKUME~1\Gaijin\LOKALE~1\Temp\XMP4C6.tmp

    0  

    Date and time

    Macro Description
    %XMP_Age(Birthdate, [Date]) Determines the number of full years between the “Birthdate” and the specified “Date.” If the second date value is not specified, the current date is used.
    Example:
    %XMP_Age("15.01.1960", "14.01.2006")
    %XMP_Age("15.01.1960", "15.01.2006")
    Output:
    45
    46
    %XMP_TimeAdd(Time, Value, [Type],
    [OutputFormat])
    Adds a specific “Value” to a “Time” (date and time). If a negative value is specified, the time is subtracted. Negative values must be enclosed in quotation marks!
    The “Time” must be given in the format “dd.mm.yyyy hh:nn:ss” or “dd.mm.yyyy”.
    If “Type” is not specified, days are added. The “Type” argument can have the following values:
    D -> Days (default)
    W -> Weeks
    M -> Months
    Y -> Years
    H -> Hours
    N -> Minutes
    S -> Seconds
    The “OutputFormat” argument specifies the display format of the returned time (see date and time formats). If no “OutputFormat” is specified, the output will be in the format “dd.mm.yyyy hh:nn:ss”.
    Example:
    %XMP_TimeAdd("12.10.2004 19:04:23",3)
    %XMP_TimeAdd("12.10.2004 19:04:23",3,"H")
    %XMP_TimeAdd("12.10.2004 19:04:23",3,"N","mm/dd/yyyy hh:nn")
    %XMP_TimeAdd("12.10.2004 19:04:23","-3")
    Output:
    15.10.2004 19:04:23
    12.10.2004 22:04:23
    10/12/2004 19:07
    09.10.2004 19:04:23
    %XMP_TimeBeats([Time]) Determines the current Internet time, or the Internet time based on the specified “Time.”
    The “Time” must be given in a valid time format, e.g. “hh:nn”, “hh:nn:ss”, or “dd.mm.yyyy hh:nn:ss”, and must be in UTC (GMT) time!
    Example:
    %XMP_TimeBeats
    %XMP_TimeBeats("20:15")
    %XMP_TimeBeats("12.10.2004 11:00:00")
    %XMP_TimeBeats("24.12.2004 11:00:00")
    Output:
    040
    885
    500
    500
    %XMP_TimeBias Determines the difference between the set time zone and UTC time, and returns it in the format commonly used for emails (+/-hhnn).
    Example:
    %XMP_TimeBias
    Output:
    +0200
    %XMP_TimeCalc(Time, Bias, [LocalFromTo],
    [OutputFormat])
    Calculates a new time based on the specified "Bias" from the given "Time."
    The "Bias" can be provided either in the format "+/-hhnn" or as an abbreviation of the time zone name, e.g., "CEST" or "MEZ." A list of supported time zones is provided on the "Time Zones" page.
    The argument "LocalFromTo" indicates whether the new time is calculated from local time or into local time. The default is from local time to another time.
    The argument "OutputFormat" specifies the display format of the returned time (see date and time formats). If no "OutputFormat" is specified, the output will be in the format "dd.mm.yyyy hh:nn:ss."
    Example:
    %XMP_TimeCalc("19:45:00","+0200",0,"hh:nn:ss")
    %XMP_TimeCalc("19:45:00","+0200",1,"hh:nn:ss")
    %XMP_TimeCalc("19:45:00","CEST",1,"hh:nn:ss")
    Output:
    17:45:00
    21:45:00
    21:45:00
    %XMP_TimeDiff(Time1, [Time2], [Type], [Format]) Determines the time span between “Time1” and “Time2.”
    The “Time” must be given in the format “dd.mm.yyyy hh:nn:ss”, “dd.mm.yyyy”, or “hh:nn:ss”!
    If “Time2” is earlier than “Time1,” the time difference is still shown as a positive number! If “Time2” is omitted, the current time is used.
    If “Type” is not specified, the number of days is calculated.
    If the argument “Type” is set to “X,” the elapsed days, hours, minutes, and seconds are calculated and displayed using the strings specified under “Format.”
    The “Format” argument contains the labels for the individual units in singular and plural form. Additionally, a separator must be specified. The individual labels must be separated by a pipe character “|.” The example shows the structure and function clearly.
    The argument “Y” is not suitable for age calculation because leap years with decimals are used in the calculation, but only whole years are returned. For age calculation, the function %XMP_Age should be used.
    The argument “Type” can have one of the following values:
    D -> Days (default)
    W -> Weeks
    M -> Months
    Y -> Years
    H -> Hours
    N -> Minutes
    S -> Seconds
    X -> Days, Hours, Minutes, Seconds
    Example:
    %XMP_TimeDiff("19:45:00","21:53:00","H")
    %XMP_TimeDiff("12.10.2004","24.12.2004")
    %XMP_TimeDiff("01.01.2004","12.10.2004")
    ---
    %XMP_TimeDiff("01.01.2004 12:00:00","08.01.2004 11:21:32","X")
    %XMP_TimeDiff("01.01.2004","12.10.2004 23:07:11","X",%-
    " Day| Days| Hr.| Hrs.| Min.| Min.| Sec.| Sec.|, ")
    %XMP_TimeDiff("01.01.2004","19.08.2004 10:30:01","X",%-
    " Day| Days |h|h|m|m|s|s|")
    %XMP_TimeDiff("01.01.2004 12:00:00","08.01.2004 12:21:00","X")
    Output:
    1
    2
    73
    285
    ---
    6 days, 23 hours, 21 minutes, 32 seconds
    285 days, 23 hrs., 7 min., 11 sec.
    231 days 10h30m1s
    7 days, 21 minutes
    %XMP_TimeParse(TimeString, [UTC],
    [OutputFormat])
    Parses a "TimeString" as it appears in the header lines of an email into a formatted time.
    If "UTC" is set to "1," the UTC time is calculated from the included bias; otherwise, the local time as contained in the "TimeString" is returned. A list of supported time zones is provided on the "Time Zones" page.
    The argument "OutputFormat" specifies the display format of the returned time (see date and time formats). If no "OutputFormat" is specified, the output will be in the format "dd.mm.yyyy hh:nn:ss".
    Example:
    %XMP_TimeParse("Tue, 5 Oct 2024 13:44:26 +0200 (CEST)")
    %XMP_TimeParse("Tue, 5 Oct 2024 13:44:26 +0200 (CEST)",1)
    Original string:
    Tue, 5 Oct 2024 13:44:26 +0200 (CEST)
    Output:
    05.10.2024 13:44:26
    05.10.2024 11:44:26
    %XMP_TimeQuart([Date], [Output]) Determines from a "Date," depending on the value of "Output," either the quarter or the season.
    If no "Date" is given or the value is invalid, the current date is used.
    If "Output" is set to "1," the season is returned as text. If "Output" is "0" or omitted, the quarter is returned.
    Example:
    %XMP_TimeQuart("20.3.2004") — Quarter
    %XMP_TimeQuart("5.4.2004") — Quarter
    %XMP_TimeQuart("20.3.2004",1)
    %XMP_TimeQuart("21.3.2004",1)
    Output:
    1st Quarter
    2nd Quarter
    Winter
    Spring

    0  

    Dialogs and Messages

                                                   
    Macro Description
    %XMP_DlgFolder([Text], [Advanced], [Selection]) Displays the dialog for selecting a folder and returns the selected path name.
    The “Text” parameter can be used to specify text that will be displayed in the dialog.
    The “Advanced” parameter defines which form the dialog will have. If the parameter is set to 1, the new dialog form is used, which, among other things, allows creating a new directory. The default value is “0”, which determines the simple dialog form.
    The “Selection” parameter can be used to specify a directory that will be preselected in the dialog.
    While the dialog is displayed, The Bat! does NOT block — the text can be edited, and the cursor can be repositioned.
    Example:
    Directory: %XMP_DlgFolder("Select a directory...",1)
    Directory: %XMP_DlgFolder("Select the Windows folder...",0,"C:\Windows")
    %XMP_DlgInput([Description], [Default text]) Opens a dialog box that displays a text input field and returns the entered text.
    The “Description” argument specifies the text to be displayed as a prompt. A maximum of three lines can be displayed. To allow line breaks and other special characters to be entered, the “Description” must be specified in the same format as in the “%XMP_StrC” macro.
    The “Default text” argument specifies the value that is already preset in the text field.
    A maximum of 1024 characters can be entered.
    After entering the text, you can press the Enter key instead of clicking the “OK” button. Note: The Esc key does not cancel the dialog but has the same effect as the Enter key!
    If the “Cancel” button is clicked, an empty string is returned.
    While the dialog is displayed, The Bat! does NOT block — the text can be edited, and the cursor can be repositioned. However, the dialog remains the topmost window.
    Example:
    Name: %XMP_DlgInput("Name:\w(Line 2)")
    Tel.: %XMP_DlgInput("Phone number:","555-123456789")
    If “Karl Huber” is entered in the first dialog and the preset text in the second dialog is confirmed, the following output is produced:
    Example output:
    Name: Karl Huber
    Tel.: 555-123456789
    %XMP_DlgOpen([Multiple selection], [Title],
    [Directory], [Filter], [Options])
    Shows the Windows file-open dialog and returns the selected file names.
    All arguments for this macro are optional. Calling it without parameters displays a dialog with default settings and allows selection of one file.
    If the “Multiple selection” argument is set to 1, multiple files can be selected. The individual file names (including path) are separated by pipe characters (|).
    “Title” specifies the window title; the default is “Open file...”.
    The “Directory” argument sets the current directory shown in the dialog.
    “Filter” allows specifying custom filters. By default, all files (.) are shown. The filter format is “Description|Mask”. After the pipe character, the file mask is given, as usual in Windows, e.g., “*.txt” for all text files.
    The “Options” argument determines the behavior of the dialog. The following options are possible:
    F-> The file must exist.
    P -> The directory must exist.
    C -> Prompt when creating a new file.
    The default is “FP” if this parameter is not specified.
    %XMP_FrmDlg(Filename, [Title], [Width],
    [Height], [Resizable], [Maximizable])
    This macro allows the implementation of a custom input form. Default data can be passed via the macro ("%XMP_FrmDlgDef"). After filling out and confirming the form, the entered or selected data can be retrieved again using the macro ("%XMP_FrmDlgRet") and further processed in the quick template.
    The first parameter must be the "filename" of the form file (an HTML file) that contains the form to be displayed. The "Title" parameter sets the title of the form window. The "Width" and "Height" parameters define the dimensions of the form window. If the value "1" is passed for "Resizable", the form window can be resized. The "Maximizable" parameter allows maximizing the form window; it must be set to "1" to enable this. Note that enabling "Maximizable" requires that "Resizable" is also enabled.
    The return value of this macro is either "1" if the user confirmed the input, or "0" if the form was closed in another way, e.g., by clicking the cancel button, pressing Alt+F4, or using the close button in the title bar.
    From this point on, the macro "%XMP_FrmDlgRet" can be used to request the entered or selected data.
    %XMP_FrmDlgDef

    %XMP_FrmDlgDef(Name, Value, [Name], [Value], ...)
    [Height], [Resizable], [Maximizable])
    Placeholders can be used in the form, which are replaced by the values passed with this macro. These placeholders begin with "%XMP_DEF:", followed by the name of the placeholder, and end with a percent sign ("%").
    To send data to the form, for example as default values, any number of name-value pairs can be specified with this macro. The "Name" parameter must correspond to a placeholder used in the form. For example, for the placeholder "%XMP_DEF:name%", the name is "name".
    If the macro is called without parameters, all previously defined default values are cleared. Since the default values remain available throughout the runtime of XMP or The Bat!, this macro should be called either before defining placeholders for a new form or after calling a form.
    %XMP_FrmDlgRet([Name], [Default]) This macro allows querying the value of a form field. The "Name" corresponds to the HTML attribute "name" of the respective form field. If no data was entered in the form field or a checkbox was not selected, no data is returned. To simplify evaluation of the return value, a default return value can be specified using the "Default" parameter, which is returned instead of an empty result.
    If no parameter is passed to the macro, all form data is returned in encoded form. The encoding corresponds to that used for HTML POST data (URL-encoded).
    %XMP_MsgBox(Text, [Title], [Style], [OkReturn], ...)
    [Button1], [Button2], [Button3])        
    Displays a message box with the specified “Text”. The text can contain the same control characters as in the macro “XMP_StrC”.
    If “Title” is not specified, the plugin name is used as the message box title (“Extended Macro Plugin”).
    “Style” defines the appearance of the window. The individual parameters must be separated by commas. The following parameters can be passed:
    Icon:
    ii > Information
    iw -> Warning
    iq -> Question
    is -> Stop / Error
    Buttons:
    o -> OK
    oc ->  OK, Cancel
    rc -> Retry, Cancel
    ari -> Abort, Retry, Ignore
    yn -> Yes, No
    ync ->   Yes, No, Cancel
    Default button: b1 -> 1st button
    b2 -> 2nd button
    b3 -> 3rd button
    b4 -> 4th button
    Appearance:
    ma ->Bound to application
    ms ->Bound to system
    mt -> Bound to task
    tm -> Always keep window on top
    Return values::
    O -> OK
    C -> Cancel
    A -> Abort
    R -> Retry
    I - Ignore
    Y -> Yes
    N -> No
    Only if “OkReturn” is set to 1, “O” is returned; otherwise, nothing is returned for OK.
    The optional parameters “Button1”, “Button2”, and “Button3” define custom captions for the buttons. If custom captions are provided, the standard button definitions (Yes, No, OK, Cancel, etc.) in “Style” are ignored. Other style parameters such as appearance and icon still apply. Depending on the number of custom captions, different return values are used:
    Button1: corresponds to the OK button, considering “OkReturn”.
    Button2: corresponds to Yes and No buttons (return values Y/N).
    Button3: corresponds to Yes, No, and Cancel buttons (return values Y/N/C).
    Example: %XMP_MsgBox("Test\nTest")%-
    %XMP_MsgBox("Test\nTest","Title","oc",1)%-
    %XMP_MsgBox("Error message","Error","is,oc,b2,ms,tm",1)%-
    %XMP_MsgBox("How do you like XMP?","Rating","iq,b2,ms,tm",1,"Good","Very good")
    %XMP_MultiDlg(Title, Text, Type, Entries,
    ResultType, [OkButton], [CancelButton])        
    This macro displays a modal dialog showing a selectable list with definable entries. Optionally, multiple or just one of these items can be returned.
    The “Title” and “Text” can be freely chosen. Optionally, the captions of the “Ok” and “Cancel” buttons can be changed with the parameters “OkButton” and “CancelButton”.
    The “Type” determines whether only one list item or multiple items can be selected and returned. If “Type” is set to “1”, only one item can be selected at a time, and the list functions like a radio button list. Otherwise (value “0”), multiple list entries can be selected.
    The “Entries” argument specifies the list of entries. Individual entries are separated by a pipe character (“|”). Each entry can optionally start with a unique identifier or number, as well as an indication whether the entry should be pre-selected. These parts must be separated by dollar signs (“$”). Thus, the format is:
    ID1$$Line1|ID2$X$Line2|ID3$$Line3
    The first entry has the ID “ID1” and is not pre-selected. The text “Line1” is shown in the list. The second entry has the ID “ID2” and is shown as selected. If the ID or selection indicator is missing, the dollar signs must still be present. For option lists (Type “1”), at least one entry should be pre-selected.
    The “ResultType” parameter specifies how the selection result is returned. The result can be returned in three different ways:
    0 -> Returns the name of the entry. In the example above, this would be “Line1” or “Line2”.
    1 -> Returns the number of the entry, starting at 1. For example, if the 2nd and 3rd entries are selected, “2|3” is returned.
    2 -> Returns the ID of the entry.
    For lists with multiple selections, the selected entries are separated by pipe characters.        
    %XMP_TextDlg(Title, Text, Default, [Length],
    [OkButton], [CancelButton])        
    This macro displays a modal dialog containing a text field.
    The “Title,” “Text,” and “Default” values can be freely chosen. Optionally, the captions of the “Ok” and “Cancel” buttons can be changed using the parameters “OkButton” and “CancelButton.”
    The “Length” parameter sets the maximum allowed number of characters, where line breaks count as 2 characters.
    Between the buttons, a counter is displayed showing the number of characters entered, the maximum allowed, and the remaining characters in the format: “entered / maximum (remaining).”        

    0  

    IDN International Domains

    Macro Description
    %XMP_AddrToACE(MailAddress) Converts one or more national email addresses, if necessary, into the internationalized format.
    Example:
    %_A=#%XMP_AddrToACE("karl@müller.at")#%-
    %_A
    %XMP_AddrToIDN("%_A")

    %XMP_AddrToACE("franz@huber.de")
    %XMP_AddrToIDN("franz@huber.de")
    Output:
    karl@xn--mller-kva.at
    karl@müller.at

    franz@huber.de
    franz@huber.de
    %XMP_AddrToIDN(MailAddress) Converts one or more internationalized email addresses, if necessary, into the national format.
    Example:
    %_A=#%XMP_AddrToACE("karl@müller.at")#%-
    %_A
    %XMP_AddrToIDN("%_A")

    %XMP_AddrToACE("franz@huber.de")
    %XMP_AddrToIDN("franz@huber.de")
    Output:
    karl@xn--mller-kva.at
    karl@müller.at

    franz@huber.de
    franz@huber.de
    %XMP_DomToACE(Domain) Converts a domain, if necessary, into a Punycode string. This format is required for internationalized domain names.
    Example:
    %_A=#%XMP_DomToACE("www.müller.de")#%-
    %_A
    %XMP_DomToIDN("%_A")

    %XMP_DomToACE("www.huber.de")
    %XMP_DomToIDN("www.huber.de")
    Output:
    www.xn--mller-kva.de
    www.müller.de

    www.huber.de
    www.huber.de
    %XMP_DomToIDN(Domain) Converts an encoded internationalized domain, if necessary, into a normal domain name.
    Example:
    %_A=#%XMP_DomToACE("www.müller.de")#%-
    %_A
    %XMP_DomToIDN("%_A")

    %XMP_DomToACE("www.huber.de")
    %XMP_DomToIDN("www.huber.de")
    Output:
    www.xn--mller-kva.de
    www.müller.de

    www.huber.de
    www.huber.de
    %XMP_IDNList(AdressList) Formats an "address list," such as one returned by macros like "%TO", "%FROM", or "%BCC", and converts IDN addresses if necessary.
    Example:
    %_TMP="%XMP_IDNList('%TO')"%-
    %TO=""%-%TO="%_TMP"

    0  

    Messages and header

    Macro Description
    %XMP_ClearLines(Text, [Max], [Min],
    [QuoteSpace])
    Removes all unnecessary blank lines from "Text".
    The argument "Max" specifies the maximum number of blank lines allowed in the text. If this number is exceeded, the extra blank lines are replaced with the number of blank lines specified in "Min".
    The default value for "Max" is "3" and for "Min" is "2"..
    If the "QuoteSpace" argument is set to "1", each blank line is filled with a space so that the quotation marks are not interrupted by empty lines.
    Example:
    %XMP_ClearLines("%TEXT",3,2)
    Original text:
    Line 1

    Line 4


    Line 10
    Output:
    Line 1

    Line 4

    Line 10
    %XMP_Gender([Name]) Attempts to determine the gender from the specified "Name".
    If "Name" is not specified, the gender is first determined from the address book entry of the recipient (the "To" field of the message editor). If this is not specified or the recipient is not listed in the address book, an attempt is made to determine the recipient’s gender based on their first name.
    The macro returns "0" for an organization (if specified in the address book), "1" for a male, and "2" for a female. If the gender is not specified in the address book, it will always return "1" for a male. In rare cases, it will return "0" for an organization or a “Family…”.
    %XMP_GetLang This macro determines the language of the original message.
    The following information is used for language detection:
    • "X-Language:"-Header
    • "Content-Language:"-Header
    • "X-Accept-Language:"-Header
    • Country of the recipient from The Bat! address book
    • Regular expression
    The return value, the regular expression, and the values used for comparison with the header lines or the address book entry can be customized individually. The necessary settings for this are included in the "XMP.ini" file in the "[CountryLanguage]" section.
    An "Item" entry in this section contains, separated by a hash symbol (#), the return value, the country names that may be entered in the address book, the abbreviations for the language, and finally a regular expression.
    The country names and language abbreviations must be separated from each other by pipe symbols (|).
    The regular expression must not contain a hash symbol (#)!
    Example:
    %XMP_GetLang
    Output:
    GE
    %XMP_HdrMailer([Standard]) Determines the sender's mail program from the message header.
    If the name of the mail program is not found, the value specified under "Standard" is returned. If the "Standard" argument is not present, an empty string is returned.
    Example:
    %XMP_HdrMailer
    Example output:
    Microsoft Outlook Express 5.00.2615.200
    The Bat! v11.4.2 Professional
    %XMP_HdrRcvTime([Entry], [LocalTime],
    [OutputFormat])
    Determines the time specified by "Entry" from the Received lines of the header. "Entry" can have the values "0" and "1", where "0" represents the time of the first Received line (sending time) and "1" represents the time of the last Received line (arrival time at the recipient's provider). If "Entry" is not specified, "0" (sending time) is assumed.
    If "LocalTime" is set to "1", the local time is returned. If "LocalTime" is set to "0" (default), the UTC time is calculated using the contained bias. A list of supported time zones is provided on the "Time Zones" page.
    The argument "OutputFormat" specifies the display format of the returned time (see date and time formats). If no "OutputFormat" is specified, the output will be in the format "dd.mm.yyyy hh:nn:ss".
    Example:
    %XMP_HdrRcvTime
    %XMP_HdrRcvTime(0)
    %XMP_HdrRcvTime(1)
    %XMP_HdrRcvTime(1,1)
    Output:
    27.02.2025 14:56:31
    27.02.2025 14:56:31
    27.02.2025 14:56:28
    27.02.2025 15:56:28
    %XMP_ListAddr(AddressList, Entry) Determines a specific address ("Entry") from a list of email addresses, such as those stored in "%OTO".
    To extract a name from the address list, the macro "XMP_ListName" can be used. The macro "XMP_ListCount" determines the number of available entries. If "Entry" is not specified, "0" (sending time) is assumed.
    Example:
    %XMP_ListAddr("%OTO",1)
    %XMP_ListCount(AddressList) Determines the number of email addresses from a list, such as those stored in "%OTO".
    To extract a name from the address list, the macro "XMP_ListName" can be used, or for the email address only, "XMP_ListAddr".
    Example:
    %XMP_ListAddr("%OTO","%XMP_ListCount('%OTO')")
    %XMP_ListName(AddressList, Entry) Determines a specific name ("Entry") from a list of email addresses, such as those stored in "%OTO".
    If no name is found, the email address is returned.
    To extract an address from the list, the macro "XMP_ListAddr" can be used. The macro "XMP_ListCount" determines the number of available entries.
    Example:
    %XMP_ListName("%OTO",1)
    %XMP_MsgID([MID]) Returns the message ID of the original message.
    If "MID" is set to "1", the text "mid:" before the message ID is omitted.
    If "MID" is set to "2", the content of the "References" header line is returned instead of the message ID.
    If "MID" is set to "3", the new reference, i.e., "References" plus "Message-ID," is returned.
    Example:
    <%XMP_MsgID>
    %XMP_MsgID(0)
    %XMP_MsgID(1)
    %XMP_MsgID(2)
    %XMP_MsgID(3)
    Output:
    mid:779938887.20040931000449@gmx.de
    779938887.20040931000449@gmx.de
    <1501856080.20040930205831@gmx.de> <872297055.20040930235903@gaijin.at>
    <1501856080.20040930205831@gmx.de> <872297055.20040930235903@gaijin.at> <779938887.20040930235945@gaijin.at>
    %XMP_NoSubj([Subject]) If the subject in the current message is empty, the value specified under "Subject" is returned. Otherwise, the macro returns the current subject.
    If "Subject" is not specified, "(no subject)" is returned.
    Example:
    %XMP_NoSubj("EMPTY")%-
    %SUBJ="%XMP_NoSubj"
    In a reply to a message with an empty subject, the example results in the output "Re: EMPTY," and the new subject is set to "Re: (no subject)."
    %XMP_NoTo([Recipient]) If both the "TO" and "CC" fields in the current message are empty, the value specified under "Recipient" is returned. Otherwise, the content of the "TO" field is returned.
    If "Recipient" is not specified, "(hidden recipients)" is returned.
    Example:
    %XMP_NoTo("Secret")%-
    %TO="%XMP_NoTo"
    In a reply to a message with empty recipient fields, the example results in the output "SECRET," and the new recipient is set to "(hidden recipients)".
    %XMP_QuoteAdd(Text, [Character]) Adds the specified quote "character" at the beginning of each line in the "text".
    If "Character" is not specified, ">" is used as the default.
    Example:
    %XMP_QuoteAdd("%TEXT")
    Output:
    > Line 1
    > Line 2
    > Line 3
    %XMP_QuoteDel(Text, [MaxLength], [Character]) Removes all quote characters from the "text".
    "MaxLength" specifies the maximum length of a quote character. If "MaxLength" is not specified, 6 characters are assumed.
    "Character" specifies the quote character to be removed. The default value is ">". If a space follows the quote character, it is also removed.
    Example:
    %XMP_QuoteDel("%TEXT",3)
    Text:
    >>> Line 1
    A> AB> ABC> AB> Line 2
    > > > > > Line 3
    >> >> Line 4
    Output:
    Line 1
    ABC> AB> Line 2
       Line 3
    Line 4
    In line 2, nothing is removed from "ABC>" onwards because the length (4 characters) exceeds the maximum length of 3 characters.
    In line 3, the first space after the quote character is removed, while the remaining two spaces are kept to preserve the indentation.
    %XMP_Sig Returns a signature delimiter (without a following line break). A proper signature delimiter consists of the characters "-- " (dash, dash, space).
    Example:
    %XMP_Sig
    Best regards
    Output:
    --
    Best regards
    %XMP_SubjClean([Subject], [Alternative]) Removes all reply and forward prefixes from the subject.
    The following prefixes are recognized and removed:
    • antw
    • antwort
    • aw
    • betr
    • betrifft
    • betreff
    • forw
    • fw
    • fwd
    • ha
    • rcpt
    • re
    • ref
    • war
    • was
    • wg
    • wtr
    Additionally, further prefixes can be specified in the "Alternative" parameter. Each prefix must be separated from the others by a pipe symbol (|).
    If "Subject" is not specified or is empty, the subject of the current message is used.
    Example:
    %XMP_SubjClean("Re: Fwd[3]: Re[5]: Odp: Wtr: Betr: DP: OriginalSubject","dp|odp")
    Output:
    OriginalSubject
    %XMP_SubjCount([NoFwds], [Subject],
    [AltRe], [AltFwd])
    Counts the reply or forward prefixes at the beginning of a subject and returns the count.
    The following prefixes are recognized and removed:
    • antw
    • antwort
    • aw
    • betr
    • betrifft
    • betreff
    • forw
    • fw
    • fwd
    • ha
    • rcpt
    • re
    • ref
    • war
    • was
    • wg
    • wtr

    Additionally, further reply prefixes can be specified with the "AltRe" parameter, and additional forward prefixes with the "AltFwd" parameter. In both parameters, individual entries must be separated by a pipe symbol ("|").
    If the parameter "NoFwds" is set to "1", forwards are not counted.
    If "Subject" is not specified, the subject of the current message is used.
    Example:
    %XMP_SubjCount(0,"Re: Fwd[3]: Re[5]: Wtr: Betr: Originalbetreff")
    %XMP_SubjCount(1,"Re: Fwd[3]: Re[5]: Wtr: Betr: Originalbetreff")
    Output:
    11
    7
    %XMP_UrlAttach(URL, FileName) This macro creates an Internet shortcut from the specified "URL" and attaches it to the current message with the given "filename." The extension ".url" is automatically added to the filename.
    Example:
    %XMP_UrlAttach("https://www.ritlabs.com/","My Webseite")

    0  

    Strings

    Macro Description
    %XMP_ArgCount(Text, [Delimiter],
    [Quotes])
    Determines the number of entries in a "Text" that are separated by one of the specified "Delimiter" characters. Delimiters inside any of the "Quotes" are ignored.
    If "Delimiter" is not specified, a space is assumed. If no "Quotes" are specified, a standard quote (") is used.
    Example:
    %XMP_ArgCount(|"ABC 123 XYZ"789 test1 test2|)
    %XMP_ArgCount(|"ABC,123,XYZ" 789,test1,test2|,|,|)
    %XMP_ArgCount(|'ABC#123#XYZ" 789#test1:test2|,|#:|,|'"|)
    Output:
    3
    3
    3
    %XMP_ArgItem(Text, Entry [Delimiter],
    [Quotes])
    Returns a specific "Entry" from a "Text" that is separated from other entries by one of the specified "Delimiter" characters. Delimiters inside any of the "Quotes" are ignored.
    If "Delimiter" is not specified, a space is assumed. If no "Quotes" are specified, a standard quote (") is used.
    Example:
    %XMP_ArgItem(|"ABC 123 XYZ"789 test1 test2|,|2|)
    %XMP_ArgItem(|"ABC,123,XYZ" 789,test1,test2|,|3|,|,|)
    %XMP_ArgItem(|'ABC:123#XYZ" 789#test1:test2|,|1|,|#:|,|'"|)
    Output:
    test1
    test2
    'ABC:123#XYZ" 789
    %XMP_Decode(Text, Method) Decodes a "Text" in MIME format (Base64) or Quoted-Printable format.
    The "Method" argument specifies whether the text is in Base64 format (argument "B") or Quoted-Printable format (argument "Q").
    Example:
    %XMP_Decode("RGV1dHNjaGxhbmQgaXN0IHNjaPZu","B")
    %XMP_Decode("est une soci=E9t=E9 Suisse","Q")
    Output:
    Germany is beautiful
    est une société Suisse
    %XMP_Encode(Text, Method) Encodes a "Text" as MIME (Base64) or Quoted-Printable.
    The "Method" argument specifies whether the text should be encoded as Base64 (argument "B") or Quoted-Printable (argument "Q").
    Example:
    %XMP_Encode("Germany is beautiful","B")
    %XMP_Encode("est une société Suisse","Q")
    Output:
    RGV1dHNjaGxhbmQgaXN0IHNjaPZu
    est une soci=E9t=E9 Suisse
    %XMP_Grep(Text, RegExp, [Output]) Searches a "Text" line by line using the regular expression "RegExp". "Output" specifies which lines should be returned:
    M -> Returns all lines matching the regular expression. (Default if not specified)
    N -> Returns all lines not matching the regular expression.
    B -> Returns all lines before the first matched regular expression.
    A - > Returns all lines after the first matched regular expression.
    I -> Can be used additionally with "A" or "B" to include the line matching the regular expression as well.
    Note: Since problems may occur if the "Text" contains quotes, these are replaced with the hexadecimal code 0x02.
    Therefore, in regular expressions, the hexadecimal code 0x02 ("\x02") must be used for a quote instead of "\x22".
    Example:
    All lines containing "http://www.":
    %XMP_Grep("%TEXT","http:\/\/www\.")
    Example Output:
    All lines containing "http://www.":
    > Our URL is https://www.ritlabs.com
    On https://www.ritlabs.com you can also find the Extended Macro Plugin
    https://www.ritlabs.com
    %XMP_HtmlDec(Text, [Options]) This macro decodes HTML entities in a "Text" into the corresponding special characters.
    The optional "Options" argument specifies the type of decoding:
    E -> Decodes HTML entities (except encoded HTML control characters) into national special characters.
    This method is used if the "Options" parameter is not specified.
    H -> Decodes HTML control characters (greater-than, less-than, double quotes, and ampersand).
    Example:
    %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;') 
    %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;','H') 
    %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;','EH')
    Output:
    &lt;b&gt;&quot;àéî€ &amp; äöüß&quot;&lt;/b&gt; 
    <b>"&#224;&#233;&#238;&#8364; & &auml;&ouml;&uuml;&szlig;&quot;</b> 
    <b>"àéî€ &amp; äöüß"</b>
    %XMP_HtmlEnc(Text, [Options]) This macro encodes special characters in a "Text" into HTML entities.
    The optional "Options" argument specifies the type of encoding:
    E -> Encodes national special characters, e.g., German umlauts, into named entities. This method is used if the "Options" parameter is not specified.
    U -> Encodes national special characters, e.g., German umlauts, using their character codes.
    H -> Encodes HTML control characters (greater-than, less-than, double quotes, and ampersand).
    Example:
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>') 
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','U') 
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','H') 
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','EH') 
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','UH')
    Output:
    <b>&quot;&agrave;&eacute;&icirc;&euro; &amp; &auml;&ouml;&uuml; &szlig;&quot;</b> 
    <b>&quot;&#224;&#233;&#238;&#8364; &amp; &#228;&#246;&#252;&#223; &quot;</b> 
    &lt;b&gt;&quot;àéî€ &amp; äöüß&quot;&lt;/b&gt; 
    &lt;b&gt;&quot;&agrave;&eacute;&icirc;&euro; &amp; &auml;&ouml; &uuml;&szlig;&quot;&lt;/b&gt; 
    &lt;b&gt;&quot;&#224;&#233;&#238;&#8364; &amp; &#228;&#246; 
    ü&#223;&quot;&lt;/b&gt;
    %XMP_LineBtw(Text, Start, End, [StartPos,
    EndPos])
    Returns the part of a line in "Text" between "Start" and "End". The search is case-insensitive.
    "StartPos" and "EndPos" indicate whether the search terms are at the start or end of the line. 1 stands for the start or end of the line. If "StartPos" or "EndPos" is 0 or omitted, the entire line is searched for "Start" and "End".
    Example Text:
    Name: Huber, Karl
    Location: 1234 City S/N: 173993783892.TEST
    Example:
    %XMP_LineBtw("%TEXT","Name:",", ",0,1)
    %XMP_LineBtw("%TEXT","Location:","",0,0)
    %XMP_LineBtw("%TEXT","S/N:",".test",0,0)
    Example Output:
    Huber
    1234 City
    173993783892
    %XMP_REIsMatch(Text, Search, [StartPos],
    [Case])
    Searches "Text" for "Search" using a regular expression (PCRE). Returns "1" if found, otherwise "0".
    The optional "StartPos" parameter specifies the start position for the search. "0" corresponds to the beginning of the text.
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_REIsMatch("abc","b")
    %XMP_REIsMatch("abc","b",2)
    %XMP_REIsMatch("abc","B",0,1)
    Output:
    1
    0
    1
    %XMP_RERepl(Text, Search, New, [Case]) Searches in the "Text" for "Search" using a regular expression (PCRE) and replaces it with "New". Returns "1" if found, otherwise "0".
    The optional parameter "StartPos" can specify the starting position for the search. "0" corresponds to the beginning of the text.
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_RERepl("AbC AbC AbC","(b)","[$1]")
    Output:
    A[b]C A[b]C A[b]C
    %XMP_ReX(Text, Expression,[SubPatt]) This macro is a simplified version of The Bat!'s RegExp macros. The argument "Text" specifies the text to search. "Expression" is the regular expression to search for. If "SubPatt" is specified, the corresponding sub-pattern is returned; otherwise, the first sub-pattern is returned.
    If "SubPatt" is specified, it works like "%REGEXPBLINDMATCH". If not specified, it works like "%REGEXPMATCH".
    Note: Quotes in the "Text" are replaced by the hex code 0x02 to avoid issues. Therefore, in the regular expressions, use the hex code 2, i.e., "\x02" instead of "\x22" for quotes.
    Example:
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*")
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*","0")
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*",3)
    Output:
    test
    abc test TEXT abc
    TEXT
    %XMP_StrAttach(Text, Filename) Saves the "Text" into a temporary file with the specified "Filename" and attaches this file to the current message.
    Returns "0" if an error occurs, otherwise "1".
    The temporary file is NOT deleted afterward, as The Bat! would not be able to find it or attach it. All files created by this macro are deleted when the plugin is unloaded (The Bat! is closed).
    Example:
    %XMP_StrAttach("%TEXT","Originaltext.txt")
    %XMP_StrC(Text) Outputs the specified "Text", replacing escaped special characters.
    The following special characters can be used:
    \\ -> Backslash
    \n -> Line feed
    \r -> Carriage return
    \t -> Tab
    \w -> Carriage return + Line feed (equivalent to "\r\n")
    \cCHR -> CHR is the character code from 000 to 255 and MUST be three digits!
    \xHH -> HH is the hexadecimal code from 00 to FF and MUST be two digits! (Case-insensitive.)
    Example:
    %XMP_StrC("\c034Line1\c034\nLine2\tTab\n\nLine4")
    --
    %XMP_StrC("\x55\x56\x57\x0A\c034XYZ\c034")
    Output:
    "Line1"
    Line2     Tab

    Line4
    --
    UVW
    "XYZ"
    %XMP_StrChar(CharCode,
    [CharCode], ...)
    Converts the specified character codes (from 0 to 255) into text and returns it.
    Example:
    %XMP_StrChar(65,66,67,13,10,49,50,51)
    Output:
    ABC
    123
    %XMP_StrCheck(Text, Check,
    [AlternativeChars])
    Checks if the specified "Text" consists of certain characters.
    The "Check" parameter can have the following values:
    U -> (Upper) Checks if only uppercase letters are in the "Text".
    L -> (Lower) Checks if only lowercase letters are in the "Text".
    N -> (Numeric) Checks if only numbers are in the "Text".
    In "AlternativeChars", additional characters allowed in the "Text" can be specified.
    Returns "1" if the text matches the pattern, otherwise "0".
    Example:
    %XMP_StrCheck('Hello','L')
    %XMP_StrCheck('Hello','UL')
    %XMP_StrCheck('Hello, this is a test','UL',' ,')
    %XMP_StrCheck('123-456.789','N','-.')
    Output:
    0
    1
    1
    1
    %XMP_StrCount(Text, SearchText, [Case]) Returns the number of occurrences of "SearchText" in "Text".
    If "Case" = 1, the search is case-insensitive.
    Example:
    %XMP_StrCount("Abc ABC abC abc","abc")
    %XMP_StrCount("Abc ABC abC abc","abc",1)
    Output:
    1
    5
    %XMP_StrDup(Text, Count) Repeats the "Text" multiple times. "Count" specifies how many times.
    Example:
    %XMP_StrDup("=-",20)
    Output:
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    %XMP_StrIns(OriginalText, Text,
    Start/Alignment, [Length])
    Inserts "Text" into "OriginalText".
    "Start" specifies the start position, "Length" specifies the number of characters to overwrite.
    Default: Start = 1, Length = 0.
    Instead of a start position, you can use an alignment:
    L -> Left-aligned
    R -> Right-aligned
    M -> Centered (odd length → more to the left)
    N -> Centered (odd length → more to the right)
    Example:
    %XMP_StrIns("123456789","ABC")
    %XMP_StrIns("123456789","ABC","R")
    %XMP_StrIns("123456789","ABC","L")
    %XMP_StrIns("123456789","ABC",4)
    %XMP_StrIns("123456789","ABC",4,1)
    %XMP_StrIns("123456789","ABC",4,999)
    Output:
    ABC123456789
    123456ABC
    ABC456789
    123ABC456789
    123ABC56789
    123ABC
    %XMP_StrItem(Text, Delimiter, Entry) Reads a specific "Entry" from a "Text" separated by a "Delimiter".
    Example:
    %XMP_StrItem("123#ABC#XYZ","#",2)
    Output:
    ABC
    %XMP_StrItemCnt(Text, Delimiter) Returns the number of entries in "Text" separated by "Delimiter".
    Example:
    %XMP_StrItemCnt("123#ABC#XYZ","#")
    Output:
    3
    %XMP_StrLeft(Text, Count) Returns the first "Count" characters from "Text".
    Example:
    %XMP_StrLeft("123456789",3)
    Output:
    123
    %XMP_StrLen(Text) Returns the length of the specified text.
    Example:
    %XMP_StrLen("ABCEDEF")
    Output:
    7
    %XMP_StrLines(Text, [Start], [Count]) Reads "Count" lines from "Text" starting at line "Start".
    Omitting "Start" or "Count" defaults to 1 line.
    Example:
    %XMP_StrLines("%TEXT",2,2)
    Output:
    Line2
    Line3
    %XMP_StrLnCnt([Text]) Determines the number of lines in the specified "Text".
    If "Text" is not specified, the message body of the original message is used.
    Example:
    %XMP_StrLnCnt
    %XMP_StrLnCnt("")
    %XMP_StrLnCnt("%_VAR")
    Output:
    25
    0
    3
    %XMP_StrMid(Text, Start, [Count]) Returns a specific "Count" of characters from "Text", starting at character "Start".
    If "Count" is not specified, all characters from "Start" onward are returned.
    Example:
    %XMP_StrMid("123456789",3,4)
    %XMP_StrMid("123456789",3)
    Output:
    3456
    3456789
    %XMP_StrPos(Text, SearchText, [Case]) Determines the position of the first occurrence of "SearchText" in "Text".
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_StrPos("AbcABCabc","ABC")
    %XMP_StrPos("AbcABCabc","ABC",1)
    Output:
    4
    1
    %XMP_StrRepl(Text, Search, New,
    [Case], [All])
    Replaces all occurrences of "Search" in "Text" with "New".
    If "Case" is set to "1", the replacement is case-insensitive.
    If "All" is set to "1", after replacing it checks again whether new occurrences were created by the previous replacement. The "Case" setting is respected here as well.
    Warning: When using "All", ensure no "infinite loops" occur, e.g.:
    "%XMP_StrRepl("XxXxXxXxXxXxXx","X","x",1,1)"!
    Example:
    %XMP_StrRepl("AbcABCabc","ABC","Xyz")
    %XMP_StrRepl("AbcABCabc","ABC","Xyz",1)
    %XMP_StrRepl("XxXxXxXxXxXxXx","XX","x",1,1)
    Output:
    AbcXyzabc
    XyzXyzXyz
    x
    %XMP_StrRev(Text) Returns the "Text" in reverse order.
    Example:
    %XMP_StrRev("Hallo")
    Output:
    ollaH
    %XMP_StrRight(Text, Count) Returns a specific "Count" of characters from "Text", starting from the last character.
    Example:
    %XMP_StrRight("123456789",4)
    Output:
    6789
    %XMP_StrTr(Text, Search, [Replace],
    [Options])
    Replaces all characters in "Text" that appear in "Search" with the corresponding characters in "Replace". This means the first character in "Search" is replaced by the first in "Replace", the second by the second, and so on.
    If "Replace" is not specified or is empty, all characters in "Search" are removed from "Text". (Equivalent to option "D".)
    The characters in "Search" and "Replace" must follow the %XMP_StrC notation, so special characters can also be used.
    The "Options" parameter can use the following values:
    D -> Removes all characters in "Search" from "Text". The "Replace" string is ignored.
    L -> Makes the search case-insensitive.
    Example:
    %XMP_StrTr("HALLO","loh","104")
    %XMP_StrTr("HALLO","loh","104","L")
    %XMP_StrTr("Hallo","HL")
    %XMP_StrTr("HALLO","Hl","XXX","DL")
    Output:
    HALLO
    4A110
    allo
    AO
    %XMP_StrTrim(Text, [LeftRight],
    [CharTypes])
    Removes all spaces and control characters at the beginning and/or end of "Text". Also removes character 160 (0xA0), sometimes used in HTML mails instead of a space.
    To remove spaces only from the left or right, set "LeftRight" to "L" or "R".
    The "CharTypes" parameter specifies which character types to remove. Options:
    (Space) -> Removes all spaces, control characters, and character 160 (0xA0). This is the default.
    A -> Removes all uppercase letters
    a -> Removes all lowercase letters
    1 -> Removes all numbers
    ! -> Removes all punctuation and printable special characters
    8 -> Removes all 8-bit characters
    S -> Removes all national special characters (from 0xBF)
    Combinations are allowed, e.g., "Aa 1" for letters, spaces, and numbers.
    Example:
    |%XMP_StrTrim("   ABC   ")|
    |%XMP_StrTrim("   ABC   ","L")|
    |%XMP_StrTrim("   ABC   ","R")|
    %XMP_StrTrim("Betrag: 129,- Euro",""," Aa!")
    %XMP_StrTrim("Betrag: 9,90 Euro",""," Aa!")
    Output:
    |ABC|
    |ABC   |
    |   ABC|
    129
    9,90
    %XMP_StrWordCnt(Text) Returns the number of words in the specified "Text".
    Various punctuation and control characters are used as separators, including period, comma, semicolon, exclamation mark, question mark, and various brackets.
    Example:
    %XMP_StrWordCnt("Wort1, Wort-2!Wort3.Wort4 Wort_5")
    Example Output:
    5
    %XMP_StrWrap(Text, [Width], [Alignment]) Wraps the specified "Text" at 70 characters. If "Width" is specified, wraps at that width.
    Spaces, tabs, and hyphens are recognized as break points. Text inside double or single quotes is not broken!
    The internal macro %WRAPPED only wraps the first paragraph. %XMP_StrWrap reformats the entire text.
    The optional third parameter specifies text alignment. Options:
    L -> Align left (default)
    R -> Align right
    C -> Center
    J -> Justify
    Example:
    %XMP_StrWrap("%CLIPBOARD",35)
    Example Output:
    At the beginning of each macro description
    the macro syntax is shown. Arguments in
    square brackets can be omitted. In that case,
    default values are used. Only the last arguments
    can be omitted.
    %XMP_UrlDec(URL) Decodes special characters in the "URL" that were previously encoded with %XMP_UrlEnc.
    Example:
    %_TMP=#%XMP_UrlEnc("mailto:test@tester.com?subject=Test Subjekt")#%-
    %_TMP
    %XMP_UrlDec("%_TMP")%-
    Output:
    mailto%3Atest%40tester%2Ecom%3Fsubject%3DTest%20Subjekt
    mailto:test@tester.com?subject=Test Subjekt
    %XMP_UrlEnc(URL, [Type]) Encodes certain characters in the "URL" that cannot appear in a URL. Can also be used for "mailto:" links.
    For example, the link "mailto:test@tester.com?subject=Das ist ein Test" would normally only set the subject to "Das", but encoding it as "mailto:test@tester.com?subject=Das%20ist%20ein%20Test" sets the full subject correctly.
    The optional argument "Type" specifies the encoding type:
    & -> Replaces all & with "&", otherwise uses hex encoding.
    < or > -> Replaces "<" and ">" with "<" or ">", otherwise uses hex encoding.
    + -> Replaces spaces with "+", otherwise spaces are "%20".
    Example:
    %XMP_UrlEnc("Test & Test")
    %XMP_UrlEnc("Test & Test","&")
    %XMP_UrlEnc("Test & Test","&<")
    %XMP_UrlEnc("Test & Test",">&")
    %XMP_UrlEnc("Test & Test","+&<")
    Output:
    Test%20%3Caaa%40bbb%2Ecom%3E%20%26%20Test
    Test%20%3Caaa%40bbb%2Ecom%3E%20&amp;%20Test
    Test%20&lt;aaa%40bbb%2Ecom&gt;%20&amp;%20Test
    Test%20&lt;aaa%40bbb%2Ecom&gt;%20&amp;%20Test
    Test+&lt;aaa%40bbb%2Ecom&gt;+&amp;+Test
    %XMP_XtrEMLs([Text], [Delimiter]) Extracts all email addresses from "Text" and returns them separated by "Delimiter".
    If "Text" is empty or not specified, the message body is used. If "Delimiter" is not specified, Windows line breaks (0x0D + 0x0A) are used.
    %XMP_XtrURLs([Text], [Delimiter],
    [SearchText])
    Extracts all URLs from "Text" and returns them separated by "Delimiter".
    If "Text" is empty or not specified, the message body is used. If "Delimiter" is not specified, Windows line breaks (0x0D + 0x0A) are used.
    The "SearchText" argument specifies a text inside the URL from which the length of the URL is determined. If found, the macro searches left and right for the first character not allowed in a URL. Default "SearchText" is "https://". Other values like "www." or "ritlabs.com" are also possible.

    0  

    Strings

    Macro Description
    %XMP_ArgCount(Text, [Delimiter],
    [Quotes])
    Determines the number of entries in a "Text" that are separated by one of the specified "Delimiter" characters. Delimiters inside any of the "Quotes" are ignored.
    If "Delimiter" is not specified, a space is assumed. If no "Quotes" are specified, a standard quote (") is used.
    Example:
    %XMP_ArgCount(|"ABC 123 XYZ"789 test1 test2|)
    %XMP_ArgCount(|"ABC,123,XYZ" 789,test1,test2|,|,|)
    %XMP_ArgCount(|'ABC#123#XYZ" 789#test1:test2|,|#:|,|'"|)
    Output:
    3
    3
    3
    %XMP_ArgItem(Text, Entry [Delimiter],
    [Quotes])
    Returns a specific "Entry" from a "Text" that is separated from other entries by one of the specified "Delimiter" characters. Delimiters inside any of the "Quotes" are ignored.
    If "Delimiter" is not specified, a space is assumed. If no "Quotes" are specified, a standard quote (") is used.
    Example:
    %XMP_ArgItem(|"ABC 123 XYZ"789 test1 test2|,|2|)
    %XMP_ArgItem(|"ABC,123,XYZ" 789,test1,test2|,|3|,|,|)
    %XMP_ArgItem(|'ABC:123#XYZ" 789#test1:test2|,|1|,|#:|,|'"|)
    Output:
    test1
    test2
    'ABC:123#XYZ" 789
    %XMP_Decode(Text, Method) Decodes a "Text" in MIME format (Base64) or Quoted-Printable format.
    The "Method" argument specifies whether the text is in Base64 format (argument "B") or Quoted-Printable format (argument "Q").
    Example:
    %XMP_Decode("RGV1dHNjaGxhbmQgaXN0IHNjaPZu","B")
    %XMP_Decode("est une soci=E9t=E9 Suisse","Q")
    Output:
    Germany is beautiful
    est une société Suisse
    %XMP_Encode(Text, Method) Encodes a "Text" as MIME (Base64) or Quoted-Printable.
    The "Method" argument specifies whether the text should be encoded as Base64 (argument "B") or Quoted-Printable (argument "Q").
    Example:
    %XMP_Encode("Germany is beautiful","B")
    %XMP_Encode("est une société Suisse","Q")
    Output:
    RGV1dHNjaGxhbmQgaXN0IHNjaPZu
    est une soci=E9t=E9 Suisse
    %XMP_Grep(Text, RegExp, [Output]) Searches a "Text" line by line using the regular expression "RegExp". "Output" specifies which lines should be returned:
    M -> Returns all lines matching the regular expression. (Default if not specified)
    N -> Returns all lines not matching the regular expression.
    B -> Returns all lines before the first matched regular expression.
    A - > Returns all lines after the first matched regular expression.
    I -> Can be used additionally with "A" or "B" to include the line matching the regular expression as well.
    Note: Since problems may occur if the "Text" contains quotes, these are replaced with the hexadecimal code 0x02. Therefore, in regular expressions, the hexadecimal code 0x02 ("\x02") must be used for a quote instead of "\x22".
    Example:
    All lines containing "http://www.&quot;:
    %XMP_Grep("%TEXT","http:\/\/www\.")
    Example Output:
    All lines containing "http://www.&quot;:
    > Our URL is https://www.ritlabs.com/
    On https://www.ritlabs.com/ you can also find the Extended Macro Plugin
    https://www.ritlabs.com/
    %XMP_HtmlDec(Text, [Options]) This macro decodes HTML entities in a "Text" into the corresponding special characters.
    The optional "Options" argument specifies the type of decoding:
    E -> Decodes HTML entities (except encoded HTML control characters) into national special characters. This method is used if the "Options" parameter is not specified.
    H -> Decodes HTML control characters (greater-than, less-than, double quotes, and ampersand).
    Example:
    %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;') %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;','H') %XMP_HtmlDec('&lt;b&gt;&quot;àéî€ &amp; &auml;&ouml;&uuml;&szlig; &quot;&lt;/b&gt;','EH')
    Output:
    &lt;b&gt;&quot;àéî€ &amp; äöüß&quot;&lt;/b&gt; <b>"&#224;&#233;&#238;&#8364; & &auml;&ouml;&uuml;&szlig;&quot;</b> <b>"àéî€ &amp; äöüß"</b>
    %XMP_HtmlEnc(Text, [Options]) This macro encodes special characters in a "Text" into HTML entities.
    The optional "Options" argument specifies the type of encoding:
    E -> Encodes national special characters, e.g., German umlauts, into named entities. This method is used if the "Options" parameter is not specified.
    U -> Encodes national special characters, e.g., German umlauts, using their character codes.
    H -> Encodes HTML control characters (greater-than, less-than, double quotes, and ampersand).
    Example:
    %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>') %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','U') %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','H') %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','EH') %XMP_HtmlEnc('<b>"àéî€ & äöüß"</b>','UH')
    Output:
    <b>&quot;&agrave;&eacute;&icirc;&euro; &amp; &auml;&ouml;&uuml; &szlig;&quot;</b> <b>&quot;&#224;&#233;&#238;&#8364; &amp; &#228;&#246;&#252;&#223; &quot;</b> &lt;b&gt;&quot;àéî€ &amp; äöüß&quot;&lt;/b&gt; &lt;b&gt;&quot;&agrave;&eacute;&icirc;&euro; &amp; &auml;&ouml; &uuml;&szlig;&quot;&lt;/b&gt; &lt;b&gt;&quot;&#224;&#233;&#238;&#8364; &amp; &#228;&#246; ü&#223;&quot;&lt;/b&gt;
    %XMP_LineBtw(Text, Start, End, [StartPos,
    EndPos])
    Returns the part of a line in "Text" between "Start" and "End". The search is case-insensitive.
    "StartPos" and "EndPos" indicate whether the search terms are at the start or end of the line. 1 stands for the start or end of the line. If "StartPos" or "EndPos" is 0 or omitted, the entire line is searched for "Start" and "End".
    Example Text:
    Name: Huber, Karl
    Location: 1234 City S/N: 173993783892.TEST
    Example:
    %XMP_LineBtw("%TEXT","Name:",", ",0,1)
    %XMP_LineBtw("%TEXT","Location:","",0,0)
    %XMP_LineBtw("%TEXT","S/N:",".test",0,0)
    Example Output:
    Huber
    1234 City
    173993783892
    %XMP_REIsMatch(Text, Search, [StartPos],
    [Case])
    Searches "Text" for "Search" using a regular expression (PCRE). Returns "1" if found, otherwise "0".
    The optional "StartPos" parameter specifies the start position for the search. "0" corresponds to the beginning of the text.
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_REIsMatch("abc","b")
    %XMP_REIsMatch("abc","b",2)
    %XMP_REIsMatch("abc","B",0,1)
    Output:
    1
    0
    1
    %XMP_RERepl(Text, Search, New, [Case]) Searches in the "Text" for "Search" using a regular expression (PCRE) and replaces it with "New". Returns "1" if found, otherwise "0".
    The optional parameter "StartPos" can specify the starting position for the search. "0" corresponds to the beginning of the text.
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_RERepl("AbC AbC AbC","(b)","[$1]")
    Output:
    A[b]C A[b]C A[b]C
    %XMP_ReX(Text, Expression,[SubPatt]) This macro is a simplified version of The Bat!'s RegExp macros. The argument "Text" specifies the text to search. "Expression" is the regular expression to search for. If "SubPatt" is specified, the corresponding sub-pattern is returned; otherwise, the first sub-pattern is returned.
    If "SubPatt" is specified, it works like "%REGEXPBLINDMATCH". If not specified, it works like "%REGEXPMATCH".
    Note: Quotes in the "Text" are replaced by the hex code 0x02 to avoid issues. Therefore, in the regular expressions, use the hex code 2, i.e., "\x02" instead of "\x22" for quotes.
    Example:
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*")
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*","0")
    %XMP_ReX("abc test TEXT abc",".*(test)(\s)(.*)\s.*",3)
    Output:
    test
    abc test TEXT abc
    TEXT
    %XMP_StrAttach(Text, Filename) Saves the "Text" into a temporary file with the specified "Filename" and attaches this file to the current message.
    Returns "0" if an error occurs, otherwise "1".
    The temporary file is NOT deleted afterward, as The Bat! would not be able to find it or attach it. All files created by this macro are deleted when the plugin is unloaded (The Bat! is closed).
    Example:
    %XMP_StrAttach("%TEXT","Originaltext.txt")
    %XMP_StrC(Text) Outputs the specified "Text", replacing escaped special characters.
    The following special characters can be used:
    \\ -> Backslash
    \n -> Line feed
    \r -> Carriage return
    \t -> Tab
    \w -> Carriage return + Line feed (equivalent to "\r\n")
    \cCHR -> CHR is the character code from 000 to 255 and MUST be three digits!
    \xHH -> HH is the hexadecimal code from 00 to FF and MUST be two digits! (Case-insensitive.)
    Example:
    %XMP_StrC("\c034Line1\c034\nLine2\tTab\n\nLine4")
    --
    %XMP_StrC("\x55\x56\x57\x0A\c034XYZ\c034")
    Output:
    "Line1"
    Line2     Tab

    Line4
    --
    UVW
    "XYZ"
    %XMP_StrChar(CharCode,
    [CharCode], ...)
    Converts the specified character codes (from 0 to 255) into text and returns it.
    Example:
    %XMP_StrChar(65,66,67,13,10,49,50,51)
    Output:
    ABC
    123
    %XMP_StrCheck(Text, Check,
    [AlternativeChars])
    Checks if the specified "Text" consists of certain characters.
    The "Check" parameter can have the following values:
    U -> (Upper) Checks if only uppercase letters are in the "Text".
    L -> (Lower) Checks if only lowercase letters are in the "Text".
    N -> (Numeric) Checks if only numbers are in the "Text".
    In "AlternativeChars", additional characters allowed in the "Text" can be specified.
    Returns "1" if the text matches the pattern, otherwise "0".
    Example:
    %XMP_StrCheck('Hello','L')
    %XMP_StrCheck('Hello','UL')
    %XMP_StrCheck('Hello, this is a test','UL',' ,')
    %XMP_StrCheck('123-456.789','N','-.')
    Output:
    0
    1
    1
    1
    %XMP_StrCount(Text, SearchText, [Case]) Returns the number of occurrences of "SearchText" in "Text".
    If "Case" = 1, the search is case-insensitive.
    Example:
    %XMP_StrCount("Abc ABC abC abc","abc")
    %XMP_StrCount("Abc ABC abC abc","abc",1)
    Output:
    1
    5
    %XMP_StrDup(Text, Count) Repeats the "Text" multiple times. "Count" specifies how many times.
    Example:
    %XMP_StrDup("=-",20)
    Output:
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    %XMP_StrIns(OriginalText, Text,
    Start/Alignment, [Length])
    Inserts "Text" into "OriginalText".
    "Start" specifies the start position, "Length" specifies the number of characters to overwrite.
    Default: Start = 1, Length = 0.
    Instead of a start position, you can use an alignment:
    L -> Left-aligned
    R -> Right-aligned
    M -> Centered (odd length → more to the left)
    N -> Centered (odd length → more to the right)
    Example:
    %XMP_StrIns("123456789","ABC")
    %XMP_StrIns("123456789","ABC","R")
    %XMP_StrIns("123456789","ABC","L")
    %XMP_StrIns("123456789","ABC",4)
    %XMP_StrIns("123456789","ABC",4,1)
    %XMP_StrIns("123456789","ABC",4,999)
    Output:
    ABC123456789
    123456ABC
    ABC456789
    123ABC456789
    123ABC56789
    123ABC
    %XMP_StrItem(Text, Delimiter, Entry) Reads a specific "Entry" from a "Text" separated by a "Delimiter".
    Example:
    %XMP_StrItem("123#ABC#XYZ","#",2)
    Output:
    ABC
    %XMP_StrItemCnt(Text, Delimiter) Returns the number of entries in "Text" separated by "Delimiter".
    Example:
    %XMP_StrItemCnt("123#ABC#XYZ","#")
    Output:
    3
    %XMP_StrLeft(Text, Count) Returns the first "Count" characters from "Text".
    Example:
    %XMP_StrLeft("123456789",3)
    Output:
    123
    %XMP_StrLen(Text) Returns the length of the specified text.
    Example:
    %XMP_StrLen("ABCEDEF")
    Output:
    7
    %XMP_StrLines(Text, [Start], [Count]) Reads "Count" lines from "Text" starting at line "Start".
    Omitting "Start" or "Count" defaults to 1 line.
    Example:
    %XMP_StrLines("%TEXT",2,2)
    Output:
    Line2
    Line3
    %XMP_StrLnCnt([Text]) Determines the number of lines in the specified "Text".
    If "Text" is not specified, the message body of the original message is used.
    Example:
    %XMP_StrLnCnt
    %XMP_StrLnCnt("")
    %XMP_StrLnCnt("%_VAR")
    Output:
    25
    0
    3
    %XMP_StrMid(Text, Start, [Count]) Returns a specific "Count" of characters from "Text", starting at character "Start".
    If "Count" is not specified, all characters from "Start" onward are returned.
    Example:
    %XMP_StrMid("123456789",3,4)
    %XMP_StrMid("123456789",3)
    Output:
    3456
    3456789
    %XMP_StrPos(Text, SearchText, [Case]) Determines the position of the first occurrence of "SearchText" in "Text".
    If "Case" is set to "1", the search is case-insensitive.
    Example:
    %XMP_StrPos("AbcABCabc","ABC")
    %XMP_StrPos("AbcABCabc","ABC",1)
    Output:
    4
    1
    %XMP_StrRepl(Text, Search, New,
    [Case], [All])
    Replaces all occurrences of "Search" in "Text" with "New".
    If "Case" is set to "1", the replacement is case-insensitive.
    If "All" is set to "1", after replacing it checks again whether new occurrences were created by the previous replacement. The "Case" setting is respected here as well.
    Warning: When using "All", ensure no "infinite loops" occur, e.g.:
    "%XMP_StrRepl("XxXxXxXxXxXxXx","X","x",1,1)"!
    Example:
    %XMP_StrRepl("AbcABCabc","ABC","Xyz")
    %XMP_StrRepl("AbcABCabc","ABC","Xyz",1)
    %XMP_StrRepl("XxXxXxXxXxXxXx","XX","x",1,1)
    Output:
    AbcXyzabc
    XyzXyzXyz
    x
    %XMP_StrRev(Text) Returns the "Text" in reverse order.
    Example:
    %XMP_StrRev("Hallo")
    Output:
    ollaH
    %XMP_StrRight(Text, Count) Returns a specific "Count" of characters from "Text", starting from the last character.
    Example:
    %XMP_StrRight("123456789",4)
    Output:
    6789
    %XMP_StrTr(Text, Search, [Replace],
    [Options])
    Replaces all characters in "Text" that appear in "Search" with the corresponding characters in "Replace". This means the first character in "Search" is replaced by the first in "Replace", the second by the second, and so on.
    If "Replace" is not specified or is empty, all characters in "Search" are removed from "Text". (Equivalent to option "D".)
    The characters in "Search" and "Replace" must follow the %XMP_StrC notation, so special characters can also be used.
    The "Options" parameter can use the following values:
    D -> Removes all characters in "Search" from "Text". The "Replace" string is ignored.
    L -> Makes the search case-insensitive.
    Example:
    %XMP_StrTr("HALLO","loh","104")
    %XMP_StrTr("HALLO","loh","104","L")
    %XMP_StrTr("Hallo","HL")
    %XMP_StrTr("HALLO","Hl","XXX","DL")
    Output:
    HALLO
    4A110
    allo
    AO
    %XMP_StrTrim(Text, [LeftRight],
    [CharTypes])
    Removes all spaces and control characters at the beginning and/or end of "Text". Also removes character 160 (0xA0), sometimes used in HTML mails instead of a space.
    To remove spaces only from the left or right, set "LeftRight" to "L" or "R".
    The "CharTypes" parameter specifies which character types to remove. Options:
    (Space) -> Removes all spaces, control characters, and character 160 (0xA0). This is the default.
    A -> Removes all uppercase letters
    a -> Removes all lowercase letters
    1 -> Removes all numbers
    ! -> Removes all punctuation and printable special characters
    8 -> Removes all 8-bit characters
    S -> Removes all national special characters (from 0xBF)
    Combinations are allowed, e.g., "Aa 1" for letters, spaces, and numbers.
    Example:
    |%XMP_StrTrim("   ABC   ")|
    |%XMP_StrTrim("   ABC   ","L")|
    |%XMP_StrTrim("   ABC   ","R")|
    %XMP_StrTrim("Betrag: 129,- Euro",""," Aa!")
    %XMP_StrTrim("Betrag: 9,90 Euro",""," Aa!")
    Output:
    |ABC|
    |ABC   |
    |   ABC|
    129
    9,90
    %XMP_StrWordCnt(Text) Returns the number of words in the specified "Text".
    Various punctuation and control characters are used as separators, including period, comma, semicolon, exclamation mark, question mark, and various brackets.
    Example:
    %XMP_StrWordCnt("Wort1, Wort-2!Wort3.Wort4 Wort_5")
    Example Output:
    5
    %XMP_StrWrap(Text, [Width], [Alignment]) Wraps the specified "Text" at 70 characters. If "Width" is specified, wraps at that width.
    Spaces, tabs, and hyphens are recognized as break points. Text inside double or single quotes is not broken!
    The internal macro %WRAPPED only wraps the first paragraph. %XMP_StrWrap reformats the entire text.
    The optional third parameter specifies text alignment. Options:
    L -> Align left (default)
    R -> Align right
    C -> Center
    J -> Justify
    Example:
    %XMP_StrWrap("%CLIPBOARD",35)
    Example Output:
    At the beginning of each macro description
    the macro syntax is shown. Arguments in
    square brackets can be omitted. In that case,
    default values are used. Only the last arguments
    can be omitted.
    %XMP_UrlDec(URL) Decodes special characters in the "URL" that were previously encoded with %XMP_UrlEnc.
    Example:
    %_TMP=#%XMP_UrlEnc("mailto:test@tester.com?subject=Test Subjekt")#%-
    %_TMP
    %XMP_UrlDec("%_TMP")%-
    Output:
    mailto%3Atest%40tester%2Ecom%3Fsubject%3DTest%20Subjekt
    mailto:test@tester.com?subject=Test Subjekt
    %XMP_UrlEnc(URL, [Type]) Encodes certain characters in the "URL" that cannot appear in a URL. Can also be used for "mailto:" links.
    For example, the link "mailto:test@tester.com?subject=Das ist ein Test" would normally only set the subject to "Das", but encoding it as "mailto:test@tester.com?subject=Das%20ist%20ein%20Test" sets the full subject correctly.
    The optional argument "Type" specifies the encoding type:
    & -> Replaces all & with "&", otherwise uses hex encoding.
    < or > -> Replaces "<" and ">" with "<" or ">", otherwise uses hex encoding.
    + -> Replaces spaces with "+", otherwise spaces are "%20".
    Example:
    %XMP_UrlEnc("Test & Test")
    %XMP_UrlEnc("Test & Test","&")
    %XMP_UrlEnc("Test & Test","&<")
    %XMP_UrlEnc("Test & Test",">&")
    %XMP_UrlEnc("Test & Test","+&<")
    Output:
    Test%20%3Caaa%40bbb%2Ecom%3E%20%26%20Test
    Test%20%3Caaa%40bbb%2Ecom%3E%20&amp;%20Test
    Test%20&lt;aaa%40bbb%2Ecom&gt;%20&amp;%20Test
    Test%20&lt;aaa%40bbb%2Ecom&gt;%20&amp;%20Test
    Test+&lt;aaa%40bbb%2Ecom&gt;+&amp;+Test
    %XMP_XtrEMLs([Text], [Delimiter]) Extracts all email addresses from "Text" and returns them separated by "Delimiter".
    If "Text" is empty or not specified, the message body is used. If "Delimiter" is not specified, Windows line breaks (0x0D + 0x0A) are used.
    %XMP_XtrURLs([Text], [Delimiter],
    [SearchText])
    Extracts all URLs from "Text" and returns them separated by "Delimiter".
    If "Text" is empty or not specified, the message body is used. If "Delimiter" is not specified, Windows line breaks (0x0D + 0x0A) are used.
    The "SearchText" argument specifies a text inside the URL from which the length of the URL is determined. If found, the macro searches left and right for the first character not allowed in a URL. Default "SearchText" is "https://". Other values like "www." or "ritlabs.com" are also possible.

    0  

    Other

    Macro Description
    %XMP_Accounts([Global Folders],
    [Separator])
    Returns the account names or global folders of The Bat!. By default, a Windows line break (0x0D0A) is used as the separator.
    For this macro to correctly detect accounts, the file "AccOrder.CFG" must exist in The Bat!'s working directory. This file is automatically created by The Bat! once an account or a global folder has been rearranged using and the cursor keys.
    If the attribute "Global Folders" has the value "1", only global folders are returned; if the value is "2", both account names and global folder names are returned. For any other value, only account names are returned.
    Example:
    Accounts:
    %XMP_Accounts

    Global Folders:
    %XMP_Accounts(1)
    Example Output:
    Accounts:
    private@myisp.com
    info@ritlabs.com
    webmaster@ritlabs.com
    Test
    Test-IMAP

    Global Folders:
    Service
    Trash
    $JUNK$
    %XMP_Const(Constant, [StrC], [Default]) Reads the value "Constant" from the "Const" section of the file "XMP.ini" and returns it. The file "XMP.ini" must be in the same directory as the plugin.
    This allows longer or frequently used texts to be stored. For example, for path definitions that appear in many templates, this macro can prevent editing all templates if the path changes.
    Texts up to 10 KB can be stored. To also store special characters, such as line breaks, special characters as defined in the macro "%XMP_StrC" can be used. With the optional argument "StrC", these special characters are converted before output.
    The argument "Default" specifies the default output if the constant is not found or another error occurs. If "Default" is not specified, an empty string is returned.
    Example:
    %XMP_Const('Path_QT_Pack')
    %XMP_Const('Test',1)
    Content of the file "XMP.ini":
    [Const]
    Path_QT_Pack=C:\WINDOWS\Application Data\The Bat!\Templates\QT_Pack
    Test=123\wABC
    Output:
    C:\WINDOWS\Application Data\The Bat!\Templates\QT_Pack
    123
    ABC
    %XMP_CRC32(Settings, Text)

    %XMP_CRC32(Settings, Files,
    [Template])
    Calculates a CRC-32 checksum from a "Text" or one or more "Files".
    The argument "Settings" can have the following values:
    S -> String (default). Calculates and returns the CRC-32 checksum of the specified "Text".
    F -> Files. The CRC-32 checksum is calculated from the content of the specified "Files". These files are automatically attached to the current message. Files must be separated by a pipe symbol (|). The output of the macro %XMP_DlgOpen can thus be used directly.
    N -> Prevents automatic attachment of files.
    A -> Adds the result as an attachment named "Attachments.sfv". The SFV file format is compatible with Total Commander 7.56a (if no custom template is used).
    If "S" is specified as Settings, all other settings are ignored.
    The "Template" parameter allows defining how filenames and checksums are output. In the template, "{F}" is replaced with the filename and "{H}" with the CRC32 checksum. If this parameter is not specified, the template "{F} {H}" is used.
    The CRC-32 checksum is compatible with Total Commander, WinZip, WinRAR, PKZIP, ARJ, and ZMODEM.
    Example:
    %XMP_CRC32("S","Hello")
    %_Files="%XMP_DlgOpen(1,'Open')"%-
    %XMP_CRC32("FA","%_Files")%-
    %XMP_CRC32("FN","%_Files","{F} (CRC32: {H})")
    Example Output:
    78B31ED5
    Granit.bmp (CRC32: 610F207B)
    Angler.bmp (CRC32: 3B433134)
    Feder.bmp (CRC32: C3571AF8)
    %XMP_For(Variable, From, To, Template) Executes the "Template" multiple times in a row. Starting from the number "From", the "Variable" is incremented until it reaches the value "To". In the "Template", the variable can be accessed using "%%_Variable".
    Example:
    %XMP_For("x",1,3,"Line %%_x
    ")%-
    %XMP_For("y",4,8,"%%_y. Line%XMP_StrChar(10)")
    Output:
    Line 1
    Line 2
    Line 3
    Line 4
    Line 5
    Line 6
    Line 7
    Line 8
    %XMP_MD5(Settings, Text)

    %XMP_MD5(Settings, Files,
    [Template])
    Calculates the MD5 hash value from a "Text" or one or more "Files".
    The argument "Settings" can have the following values:
    S -> String (default). Calculates and returns the MD5 hash of the specified "Text".
    F -> Files. The MD5 hash is calculated from the content of the specified "Files". These files are automatically attached to the current message. Files must be separated by a pipe symbol (|). The output of the macro %XMP_DlgOpen can thus be used directly.
    N -> Prevents automatic attachment of files.
    A -> Adds the result as an attachment named "Attachments.md5". The MD5 file format is compatible with Total Commander 7.56a (if no custom template is used).
    If "S" is specified as Settings, all other settings are ignored.
    The "Template" parameter allows defining how filenames and hashes are output. In the template, "{F}" is replaced with the filename and "{H}" with the MD5 hash. If this parameter is not specified, the template "{H} *{F}" is used.
    Example Output:
    D1BF93299DE1B68E6D382C893BF1215F
    Granit.bmp (MD5: 1AC5E83598D4F2143B59A2D893C3279A)
    Angler.bmp (MD5: 203EF178BF8B0A8EC34E27E4DEDB6349)
    Feder.bmp (MD5: 3A8B85AB7B415BF3F8AFE285DFE0CE29)
    %XMP_Progress(Fill, Bar, Length,
    Total, Value)
    Draws a progress bar with the specified "Length". The "Length" defines the total length of the bar, which is filled with the character "Fill". The "Bar" character is used to indicate progress. The "Total" value refers to the maximum value of "Value", which indicates the progress.
    Example:
    [%XMP_Progress("-","#",25,7,6)]
    [%XMP_Progress(".","X",25,100,50)]
    Output:
    [#####################----]
    [XXXXXXXXXXXX.............]
    %XMP_Random([Max])

    %XMP_Random([Min], [Max])
    Generates a random number between "Min" and "Max".
    If "XMP_Random" is called without parameters, a number between 1 and 100 is returned.
    If only one argument is specified, a number between 1 and "Max" is returned.
    Example:
    %XMP_Random
    %XMP_Random(10)
    %XMP_Random(100,999)
    Output:
    78
    3
    732
    %XMP_Rot13(Text) Encodes and decodes "Text" using ROT-13.
    Example:
    %XMP_Rot13("ROT13 Test-Text")
    %XMP_Rot13("EBG13 Grfg-Grkg")
    Output:
    EBG13 Grfg-Grkg
    ROT13 Test-Text
    %XMP_Select(Value, Default, Value1,
    Output1, [Value2], [Output2], ...)
    Checks if "Value" matches any of the specified "Value1", "Value2", ... and returns the corresponding "Output". If no value matches, "Default" is returned.
    Example:
    %_Color="G"%-
    %_Number="3"%-
    %XMP_Select(%_Color,"no color","R","Red","G","Green","B","Blue")
    %XMP_Select(%_Number,"no valid number","1","one","2","two")
    Output:
    Green
    no valid number
    %XMP_SHA1(Settings, Text)

    %XMP_SHA1(Settings, Files,
    [Template])
    Calculates the SHA1 hash from a "Text" or one or more "Files".
    The argument "Settings" can have the following values:
    S -> String (default). Calculates and returns the SHA1 hash of the specified "Text".
    F -> Files. The SHA1 hash is calculated from the content of the specified "Files". These files are automatically attached to the current message. Files must be separated by a pipe symbol (|). The output of the macro %XMP_DlgOpen can thus be used directly.
    N -> Prevents automatic attachment of files.
    A -> Adds the result as an attachment named "Attachments.sha". The SHA file format is compatible with Total Commander 7.56a (if no custom template is used).
    If "S" is specified as Settings, all other settings are ignored.
    The "Template" parameter allows defining how filenames and hashes are output. In the template, "{F}" is replaced with the filename and "{H}" with the SHA1 hash. If this parameter is not specified, the template "{H} *{F}" is used.
    Example:
    %XMP_SHA1("S","Hello")
    %_Files="%XMP_DlgOpen(1,'Open')"%-
    %XMP_SHA1("FA","%_Files")%-
    %XMP_SHA1("FN","%_Files","{F} (SHA1: {H})")
    Output:
    59D9A6DF06B9F610F7DB8E036896ED03662D168F
    Granit.bmp (SHA1: DB8FBCE9655C2503FE543E1140B6CD82245D2535)
    Angler.bmp (SHA1: 243B1AA7E2D2613FF3859BEE5022AA09DD48CBC0)
    Feder.bmp (SHA1: 34C9F1B45C5EE190A969823FF455197748CFD3AB)
    %XMP_Until(Variable, To, Template) Executes the "Template" until "Variable" reaches the value "To". In the "Template", the variable can be set or accessed using "%%_Variable".
    Example:
    %XMP_Until("x","3","%%_x=#%%CALC('%%_x + 1')#%%-
    %%_x. Line%%XMP_StrChar(10)")
    Output:
    1. Line
    2. Line
    3. Line
    %XMP_UrlDldFile(URL, Filename) Starts downloading a file from the "URL" and saves it under "Filename".
    The "URL" and "Filename" must include the full path to the file.
    The macro returns "1" for a successful download and "0" for a failed download.
    Warning: The file to download should not be too large, as the macro stops during the download and cannot be cancelled.

    0