Sorting Office (4)
Checking Mail (2)
Reading Messages (7)
The Bat! Tools (9)
Address Book (7)
Program Options (9)
|Command Line Parameters|
/CHECK and /CHECKALL
/SEND and /SENDALL
/DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE
/LDIFIMPORT and /LDIFEXPORT
/MINIMIZE, /MIN, /EXIT, /SMARTEXIT, /NOLOGO and others
What is a Command Line
The command line is a text string that is passed to the system whenever a program is executed. It contains the path to the program, followed by a set of parameters. To start a program in Windows, you can either use the Start menu "Run" command, or click on the program’s shortcut on the desktop or in the Start menu. If you start a program by clicking its shortcut, you can edit the command line in the properties of this shortcut. Right-click the shortcut, select “Properties” and under “Shortcut” change the command line in the “Target” field.
For The Bat!, the command line in a Shortcut looks like this:
"C:\Program Files (x86)\The Bat!\thebat32.exe" or "C:\Program Files\The Bat!\thebat64.exe"
You can add some start-up parameters to the command line to define a set of actions performed whenever you start the program. For example, you can switch off the The Bat! start-up logo by adding the /NOLOGO parameter:
"C:\Program Files (x86)\The Bat!\thebat32.exe" /NOLOGO
Using The Bat! command line parameters from batch files and other programs
It is possible to use The Bat! from batch files or other programs meaning that you are able to automatically send and receive emails.
For example, to send two email messages, run the following sequence of commands from a batch file, provided that the current directory is "C:\Program Files\The Bat!\thebat64.exe":
This example demonstrates using the /MAIL command line parameter for automated message creation.
Following is the description of all command line parameters that The Bat! supports.
Checking Mail - /CHECK and /CHECKALL
/CHECK can be used as a command line parameter whenever you want to check mail for one or more accounts.
/CHECKALL is used for checking mail for all accounts and exiting from The Bat! if there were no new messages received. It is a simplified form of the /CHECK* /SMARTEXIT combination.
/CHECK<account mask1>[;account mask2[;account mask3[...]]]
The account mask is used to identify which accounts to perform the check operation for. It can be:
Note: To separate account masks, use semicolons (";" character). Do not use spaces between account masks, because a space-separated mask will be interpreted as the start of the next command line parameter and will not be processed as intended.
If a mask contains space characters, enclose it in quotation marks. If a mask contains quotation marks, you should use single quotes (" ' " character).
Sending Mail - /SEND and /SENDALL
The /SEND command can be used as a command line parameter for The Bat!, whenever you want to send all queued mail from one or more accounts.
The /SENDALL command is used for sending queued mail from all accounts and exiting from The Bat!, if there were no queued messages. It is a simplified form of the /SEND* /SMARTEXIT combination.
/SEND<account mask1>[;account mask2[;account mask3[...]]]
The account mask is used to identify the accounts to perform the send operation for. It can be:
Importing Messages - /IMPORT
The /IMPORT command allows to import messages to a specified folder from RFC-822 message files or from UNIX mailbox files.
Exporting Messages and Addresses - /EXPORT
The /EXPORT command allows to export messages from a specified folder to RFC-822 message files or UNIX mailbox files. This command also allows the export of address book entries if the LDIF parameter is specified.
/EXPORTLDIF;AB="Address book 1";Group="My group";O="C:\MyGroupFile.LDIF"
Focusing on a Folder - /FOCUS
The /FOCUS command allows you to automatically focus on a specified folder in the main window.
Possible Parameters - (a parameter may be identified by two or more names):
/FocusF="\\My account\New mail";P=mypass
Automated Message Creation - /MAIL
The /MAIL command is used for automated message creation using a template, text file and attachments for a specified address.
Message Creation - mailto:
The mailto: command is used to open a new editor window in The Bat! using pre-set parameters.
mailto: is the standard Internet URL for publishing email addresses which is described in RFC 2368. This command line parameter can be used by browsers that need to open an email editor when the user clicks on a link which contains a mailto: URL.
Creating New Account –/ADD
The /ADD command allows to create new accounts. All parameters correspond to account settings.
/ADD:[parameter1 [;parameter2 [;parameter3 [...]]]
Example (write in a single line without space characters)
/ADD; User="andrew"; InServer="pop.andrew.com"; OutServer="smtp.andrew.com"; InUser="andrew"; InPassword="andrewpass"; FromAddr="firstname.lastname@example.org"; FromName="Andrew"; ReplyAddr="email@example.com"; ReplyName="Andrew"
Folder Maintenance - /OP
The /OP command is used to carry out folder maintenance.
Note: You can use several parameters, but only one argument.
Deleting Duplicates – /DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE
/DEDUPIGNOREMSGID, /DEDUPIGNORETOMSGID, /DEDUPIGNORETO and /DEDUPIGNOREDATE are independent parameters that can be used for removing duplicates.
By default, duplicates share the same Message-ID, sender (From), recipient (To) and date (Date). Messages are considered duplicates if these four attributes coincide, the other attributes are not taken into account. If two messages have different message bodies, however Message-ID, From, To and Date fields coincide, the program will delete one of these messages if you use the “remove duplicates” command.
If messages do not have Message-IDs, the program checks the subjects (Subject) instead.
If you use the /DEDUPIGNOREMSGID parameter, Message-ID is not checked, the program checks the From, To, Date and Subject fields.
If the /DEDUPIGNORETOMSGID parameter is used, both Message-ID and recipient’s address are not checked, meaning that the program compares only sender’s address, date and subject. If the Date header is missing, the program checks the Received date.
Use the /DEDUPIGNORETO parameter to check for duplicates by Message-ID, sender and date while ignoring the recipient.
By executing the /DEDUPIGNOREDATE parameter the program will ignore messages' creation date and look for the duplicates with equal Message-ID, sender and recipient.
Execution of Several Commands from a File - /BATCH
/BATCH allows executing multiple commands defined in a text file (each command being placed in one line).
For example, if you want to check your account and send queued mail from it, you can create a batch file C:\The Bat!\CheckMail.BAT which contains the following lines:
To execute this batch file from a command line, you can run The Bat! with the command line parameter /BATCH:“C:\The Bat!\CheckMail.BAT”
Exporting and Importing Address Book or Group in LDIF-file –/LDIFIMPORT and /LDIFEXPORT
thebat32.exe /lidfexport:ab="Main book":file="c:\exported\main.ldif"
You can additionally use the /LDIFNOUTF command to disable UTF-8 encoding.
Sorting Messages –/REFILTER
The /REFILTER command is used for re-filtering a folder.
Other commands - /MINIMIZE, /MIN, /EXIT, /SMARTEXIT, /NOLOGO and other
The /EXIT command is used to close The Bat! as soon as all mail transfer operations are complete.
The /SMARTEXIT command is used to close The Bat! as soon as all mail transfer operations are complete, but only if no new messages were received.
The /MINIMIZE command minimizes The Bat! to the Task Bar or to the System Tray if the respective option under Options -> Preferences -> General is enabled.
The /MIN command minimizes The Bat! to the Task Bar or to the System Tray if the respective option under Options -> Preferences -> General is enabled.
The /NOLOGO command disables the start-up screen that appears on program’s start-up. When it is used in the command line, The Bat! logo will not be displayed while program is loading its data.
Using the /OPEN command you can open a message or a vCard from a file (VCF/MSG/EML) in a separate window.
Example: thebat32.exe /OPEN:"c:\My Data\message.eml"
Using the /MSGID command you can view the needed message in a separate window. You should indicate the Message-ID of this message.
Example: thebat64.exe /msgid:firstname.lastname@example.org
If The Bat! does not find the message in the current folder, the program will offer to select a folder for searching. If you know the folder where the message is kept, you can either use the /FOCUS command or indicate its Message-ID and use the FOLDER parameter.
Examples: thebat32.exe /FocusF="\\\General\ABC Folder"/msgid:email@example.com
or thebat32.exe /msgid:firstname.lastname@example.org?folder="\\\General\ ABC Folder"
The pathname of a common folder should be specified using the following format: \\\CommonFolder\path\name\folder
The pathname of a folder should be specified using the following format: \\AccountName\path\name\folder
The /CARDFILE command allows to send submission forms.
The /TERMINATE command closes The Bat! even if there are active sessions in the queue.
Using the /reg:<name> command you can launch The Bat! from different registry key (the name of the key consists of The Bat!+<name>). For example, if you launch The Bat! using the /reg:test parameter, the key The Bat!test will be created in the Registry, and you will be able to set up The Bat! anew.
You can configure The Bat! not to specify the %EMAIL% variable by running it with the /DontWriteEmailEnvironmentVariable command line parameter, or by setting the DWORD DontWriteEmailEnvironmentVariable variable to 1 under HKEY_CURRENT_USER\Software\RIT\The Bat!
Regular expression matching allows you to test whether a string fits a specific syntactic shape. You can also search a text string for a sub-string that fits a pattern. A regular expression describes a set of strings. The simplest case is one that describes a particular string; for example, the string foo when regarded as a regular expression matches foo and nothing else. Non-trivial regular expressions use special constructs with which they can match more than one string. For example, the regular expression foo|bar matches either the string foo or the string bar; the regular expression c[ad]*r matches any of the strings cr, car, cdr, caar, cadddar and all other such strings with any number of a's and d's. The Bat! allows using regular expressions in the message editor, in the message finder, in the sorting office and in the templates.
Regular Expressions in the Message Editor
In the message editor, regular expressions can be used to search for sub-strings matching a search pattern. To find a sub-string that matches a regular expression, invoke the search dialog using the Search -> Find menu and type the regular expression, make sure that the "Regular Expression" check box is selected and start the search. Regular expressions can also be used for the Replace function in the Message Editor.
If a match is found, the text that matches the given regular expression will be marked as selected in the message editor. If the regular expression has sub-patterns, the first captured substring will be selected, i.e. for the regular expression Total amount: *(\S+) only the word following Total amount will be selected but not Total amount itself.
The default PCRE options for the message editor are PCRE_CASELESS or none for a case sensitive search. Matching is done on a string-by-string basis.
Regular Expressions in the Message Finder
You can use regular expressions when you search for messages. Select the "Match" option in the drop-down condition list. The default PCRE options for the message finder are PCRE_CASELESS+PCRE_MULTILINE or PCRE_MULTILINE for a case sensitive search. Matching is done by treating the whole message as a single string. CF/LF pairs (0D/0A) are replaced by single LF (0A) characters before matching.
Regular Expressions in the Sorting Office
It is possible to use regular expressions as signal strings in the message filters. In a filter definition in the Sorting Office dialog, choose the "match" condition to make use of "Regular expressions" in the match string. The default PCRE options for message filters are PCRE_CASELESS+PCRE_MULTILINE. Matching is done by treating the whole message as one string. CF/LF pairs (0D/0A) are replaced with single LF (0A) characters before matching.
Regular Expressions in the Templates
The Bat! allows for using regular expressions in message templates. The idea is to search some text for the first occurrence of a sub-string matching a pattern defined in a regular expression and then to insert the result of that search right back into the message text. For example, it is possible to parse incoming messages of a particular format and create new messages in another format with extra, modified or removed information. To search the original message text for a sub-string, use the %REGEXPTEXT="regexp" macro where regexp defines the search pattern. The %REGEXPQUOTES="regexp" macro does the same, but returns the result as a quotation.
When you need to search text for a particular sub-string, use the %SETPATTREGEXP="regexp" and %REGEXPMATCH="string" macro combination. regexp defines the search pattern for all subsequent occurrences of the %REGEXPMATCH macro until the next instance of %SETPATTREGEXP. It is possible to use macros to generate any text you need, e.g. %QUOTES="%SETREGEXP=""regexp""%REGEXPMATCH=""%TEXT""" is equivalent to %REGEXPQUOTES="regexp".
If a match is found, the text that matches a given regular expression is returned. If the regular expression has subpatterns, the first captured substring is returned, i.e. for the regular expression Total amount: *(\S+) only the word following Total amount will be returned but not Total amount itself. %REGEXPBLINDMATCH="string" is like the %REGEXPMATCH="string" macro except that matched string/substrings are not returned, but may be further extracted using %SUBPATT="n" macros where n is the number of a captured substring; %SUBPATT='0' returns the text matching the entire Regular Expression pattern, 1 is the text of the first matching subpattern, 2 - the second matching subpattern, etc. Thus the %REGEXPBLINDMATCH="string" macro allows you to have more than one subpattern in its results e.g.: %QUOTES="%SETPATTREGEXP=""total_amount +(\S+).*flowers_type +(\S+)""%REGEXPBLINDMATCH=""%TEXT""pay %SUBPATT=""1"" for %SUBPATT=""2"""
The default PCRE options for templates are PCRE_CASELESS+PCRE_MULTILINE+ PCRE_DOTALL. Matching is done by treating a whole message as one string. CF/LF pairs (0D/0A) are replaced with single LF (0A) characters before matching.
Regular Expressions Syntax (Basic)
A regular expression is a set of rules that describes a generalized string. If the characters that make up a particular string conform to the rules of a particular regular expression, the regular expression is said to match that string.
For example, the regular expression b. matches the strings bovine, above, Bobby, and Bob Jones, but not the strings Bell, b, or Bob. That's because the expression insists that the letter b (lowercase) must be in the string and must be followed immediately by another character.
The regular expression b+ requires the lowercase letter b at least once. This expression matches b and Bob in addition to the example matches for b. in the preceding paragraph. The regular expression b* requires zero or more bs, so it matches any string. That seems to be fairly useless, but it makes more sense as part of a larger regular expression. Bob*y, for example, matches all of Boy, Boby, and Bobby but not Boboby.
Assertions are used to anchor parts of the pattern to word or string boundaries. The ^ assertion matches the start of a string, so the regular expression ^fool matches fool and foolhardy but not tomfoolery or April fool. The following table lists the assertions:
The . (period) is an example of a regular-expression atom. Atoms are the fundamental building blocks of a regular expression. A full list of atoms appears in the following table:
A quantifier is a modifier for an atom. It can be used to specify that a particular atom must appear at least once, as in b+. The atom quantifiers are listed in the following table:
Several special characters are denoted by backslashed letters:
It is essential that regular expressions be capable of using all characters, so that all possible strings can be matched. With so many characters having special meanings, a mechanism is required that allows you to represent any arbitrary character in a regular expression. This mechanism is a backslash (\), followed by a numeric quantity. This quantity can take any of the following formats:
|Uninstalling the Program|
To uninstall the program, access the Control Panel, select The Bat! in the list of installed programs and click the "Uninstall" button. Note that your mail data (emails, address books, configuration files, etc.) is not removed when you uninstall The Bat! by clicking "Uninstall". Only the program files are deleted in this case. To remove your mail data, click the "Change" button instead of Uninstall, then select "Remove" and deselect the "Keep the working directory and all data files" check box. This will remove both program files and mail data from your computer. To make sure your mail data is removed, open the "Run" dialog box from the Start menu (Windows+R), type %email% in the "Open" edit box, and click OK. Your mail folder will be opened – it should be empty. If there are still files in this folder, remove them.