The Bat! The Bat! template / macro samples The Bat!


You are caller No. counter



Back to The Bat! FAQ / How-Do-I / Macros


Table of contents:


  1. Default new message template explained
  2. Default reply template explained
  3. "Naming" macros
  4. Sample Quick Templates
These should whet your appetite for the power of The Bat! If you want to explore these concepts a bit further why not join the discussion lists and talk things over with like minds. For the surface level stuff there's TBUDL. For the deeper, more meaningful conversations, head for TBTECH.


Default new message template explained


Templates are where the real power of The Bat! is to be found. Templates are explained in more detail here (if you're not sure what I'm on about).

Preamble : If you plan to use the templates as is given here do NOT make any changes in the commands (Macros). For convenience they are marked in RED. What you can change to suit your needs are in Pink For e.g. in the sample given below 'Hello' could be replaced with 'Dear' or 'Hi' and 'Best Regards' can be replaced with 'Cheers' or 'Affly'

This rule has been used through out this page.

With templates, you can personalise exactly how The Bat! makes you look to others. How you address your messages, how you sign them and how the content is formatted.

At the simplest level is the default account new message template:

  Hello %TOFName,

    %Cursor

  --
  Best regards,
   %FromFName                          mailto:%FromAddr

A template is used to fill in some default text in a blank message. Let's break this down a bit.
  • First of all, this one starts with:
    Hello %TOFName,
    
    "Hello" it says. %TOFName is a macro which asks The Bat! to put the "First Name" from the "To" address field into the message body at that point. So, in full it says something like Hello Fred,


  • Next we have this macro:
    %Cursor
    which tells The Bat where to put the cursor for you to start typing.


  • Now comes the sign off. It starts with a "cut mark":
    --
    
    This is a "special sequence that starts on a new line and consists of two dashes (minus signs) and a space followed by another new line.

    <NewLine><dash><dash><space><NewLine>

    This "cut mark" is recognised by many email programs and is used as a cut off point for signatures. That way, when someone replies to one of your messages, your signature (anything below the cut mark) is removed. Likewise, when you reply to a message from someone that includes cut mark, The Bat! will remove anything below the cut mark from the text you quote.


  • Finally we come to the actual signature:
      Best regards,
       %FromFName                          mailto:%FromAddr
    
    "Best Regards," it says. Then, on the next line, some more of that macro doohickey stuff: "%FromFName" calls for the inclusion of the First Name from the "From:" header field then, at the far end of the same line it says "mailto:%FromAddr". That's a bit more interesting, asking for the literal text "mailto:" to be followed by the email address part of the "From:" header. For example:
      Best regards,
       Fred                          mailto:fred@example.com
    

[Back to top]


Default reply template explained


The default reply template looks like this:
  Hello %OFromFName,

  %ODateEn, %OTimeLongEn, you wrote:

  %Quotes
  %Cursor

  --
  Best regards,
   %FromFName                            mailto:%FromAddr 
This is almost identical to the default New Message template with the exception of these two lines in the middle:
  %ODateEn, %OTimeLongEn, you wrote:

  %Quotes
Let's gloss over this to say that these lines put in something like:
  Monday, October 01, 2001, 7:59:22 PM, you wrote:

  AB> Hi Marck,

  AB> How's it going in your neck of the woods?
With the date / time taken from the original message "Creation" time and date and the "%QUOTES"
macro which puts in the text text of the original message. Too glossy? Okay, the quoted text in this example is shown with the default quote prefix of "Initials". You can change this in your template using the %QUOTESTYLE= macro.

[Back to top]


"Naming" macros


This is a small collection of macro combinations which are useful when dealing with names and addresses. The best way to use these snippets is to put them into a quick template with an appropriate "handle" (name) and then use them as needed in your main templates with a %QINCLUDE='handle' construct. These are building blocks as opposed to complete solutions for anything in particular.
%ABofromFIRSTNAME="%OFROMFNAME"

Use the first name from the address book OR the first name from the original sender's address if the address book does not contain a first name for the sender


%ABtoFIRSTNAME="%TOFNAME"

Use the first name from the address book OR the first name from the original sender's address if the address book does not contain a first name for the sender


%TO=""%TO='%ABOFROMFirstName=''"%OFROMNAME"'' <%OFROMADDR>'

This more sophisticated use of the first example can be used to personalise the To: address for a message to a close friend. I use this in the group template for family and friends


%SETPATTREGEXP="(.*)\@"%REGEXPMATCH="%OTOADDR"

This little regular expression macro will extract the first "name" part of an email address - the bit before the '@' sign.


%TO=""%TO='"%OFROMNAME on %ABoreplyHANDLE=''%ABoreplyNAME''" %-
<%OREPLYADDR>'

Here's one that is good for address book reply templates for lists. It replaces the To information with the "John Doe on TBUDL" <tbudl@thebat.dutaint.com> format of addressing. Keep a group of list addresses in your address book. If the name of the list is a bit long, this macro takes the Address Book "Handle" field contents as the 'bit to tack on'.


%TO=""%TO='"%ofromname on %SETPATTREGEXP=''(.*)\@''%-
%REGEXPMATCH=''%OTOADDR''" <%OTOADDR>'

This is a combination / variant on the previous example. It uses the first part of email address from the original list posting to which you are replying as the 'bit to tack on'.


%SUBJECT="Re:%SETPATTREGEXP='(?i)\A(?::?\s*)%- (?:(?:\s*(?:fwd|re|aw|fw|antwort|wg|forw)%- (?:\[\d*\])?:\s*)|(?:\s*\[.*\]\s*))*%- (.*?)(?:(?:\s*\((?:was|war):.*\)\s*)|%- (?:\((?:PGP|S/MIME) Decrypted\)))*\z'%- %REGEXPMATCH='%OSUBJ'"

Here's a golden oldie. This regular expression macro will tidy up a messy subject line. You know, the ones that go 'Fwd: Re: re[4]: fw: re: The subject at hand (PGP Decrypted)' and leave it simple saying 'Re: Subject at hand'


%TO='%SETPATTREGEXP=''^(.*?)[,;]?\s*$''%-
%REGEXPMATCH=''%-
%SETPATTREGEXP="^(.*?[,;]?)([^,;]*%-
(me@example.com|me2@elsewhere.com)%-
[^,;]*[,;]?)(.*)$"%-
%REGEXPBLINDMATCH="%OTOLIST, %OCCLIST"%-
%SUBPATT="1"%SUBPATT="4"'''

This final one addresses messages to all orginial recipients (other than yourself). You have to edit the email addresses (in pink) to be those of yours. If you have only one address, remove the extra address and the '|' character. If you have more than two addresses, you should add an extra '|' character (logical 'OR') for each address. Of course, you may want to receive copies yourself, in which case use this form of the macro:


%TO='%SETPATTREGEXP=''^(.*?)[,;]?\s*$''%-
%REGEXPMATCH=''%-
%SETPATTREGEXP="^(.*?[,;]?)([^,;]*%-
[^,;]*[,;]?)(.*)$"%-
%REGEXPBLINDMATCH="%OTOLIST, %OCCLIST"%-
%SUBPATT="1"%SUBPATT="3"'''

[Back to top]


Sample Quick Templates


Many thanks go to Raj for his help compiling this section

To see the benefits you would first need to create multiple Quick Templates. (Options->Quick Templates->Add or Shft+Ctrl+Q). It is usually quite useful to make these more sophisticated quick templates available Bat!-wide by turning on the 'Share with other accounts' option.

Rules if you plan to use them as shown here : You can personalise whatever is coloured in Pink. QT names can also be changed... But ensure that the correct name is used.

One thing to be careful with - the samples here refer to some cookie files as existing on d:\bat\... - you should modify these to reflect existing files on your own system. You will find links to some example files at the bottom of this page.

Quick Template 1.

Description : Formal Signature
Handle : FS

%IF:"%DOW"="Friday":"%COOKIE='d:\bat\Friday Greetings.txt'"
%ISSIGNATURE
Warm Regards

<Your Name>
<Your Company Name>
<By Line if Any>


Web Site : http://www.yourhost.com
mailto:%FROMADDR
 

Quick Template 2.

Description : Informal Signature
Handle : IS

%IF:"%DOW"="Friday":"%COOKIE='d:\bat\Friday Greetings.txt'"
%ISSIGNATURE
Cheers

<First Name>

mailto:%FromAddr



Quick Template 3.

Description : Last Lines for new Message
Handle : LLNM

%WRAPPED="Thought for the day : %COOKIE='d:\bat\cookies for bat.txt'"
Composed on %DATESHORT at %TIME using The Bat Ver %THEBATVERSION
%SINGLERE
Attachments = %ATTACHMENTS



Quick Template 4.

Description : Last Lines for Reply Message
Handle : LLRM

%WRAPPED="Thought for the day : %COOKIE='d:\bat\cookies for bat.txt'"
Replied on %DATESHORT at %TIME using The Bat Ver %THEBATVERSION
%SINGLERE
Attachments = %ATTACHMENTS


Quick Template 5.

Description : Fixup a messy Re: subject
Handle : FIXSUBJ

%SUBJECT="Re:%SETPATTREGEXP='(?i)\A(?::?\s*)%-
(?:(?:\s*(?:fwd|re|aw|fw|antwort|wg|forw)%-
(?:\[\d*\])?:\s*)|(?:\s*\[.*\]\s*))*%-
(.*?)(?:(?:\s*\((?:was|war):.*\)\s*)|%-
(?:\((?:PGP|S/MIME) Decrypted\)))*\z'%-
%REGEXPMATCH='%OSUBJ'"


Quick Template 6.

Description : International Reply pre-amble
Handle : INTRO

%WRAPPED='Historians believe that on %ODATE%-
%SETPATTREGEXP="(?m-s)Date\:\s*?((.*?[\d]{4})\s*?([\d]{0,2}\:%-
[\d]{0,2}\:[\d]{0,2})\s*?(.*))"%-
%REGEXPBLINDMATCH="%HEADERS" , at %SUBPATT="3"[GMT%SUBPATT="4"]%-
(which was %OTIME where I live) you wrote:'%-
%Qinclude='FIXSUBJ'


Quick Template 7.

Description : Quoted text, no PGP or ads
Handle : REQ

%quotes='%SETPATTREGEXP="(?is)((\s*)?\n?-----BEGIN PGP %-
SIGNED.*?\n(Hash:.*?\n)?\s*)?(.*?)(^(%-
-*?\s*?--\s*\n|_{40,}\s*\n|%-
\n-----BEGIN PGP SIGNATURE.*s?\n|%-
-+\s+.*roups.*~--\>)|%-
\n+Get your FREE download|%-
\z)"%REGEXPBLINDMATCH="%text"%SUBPATT="4"'


Quick Template 8.

Description : Body for reply with intro and quotes
Handle : BRTQB

%Qinclude='intro'
%Cursor
%Qinclude='REQ'


Quick Template 9.

Description : Addressing for Account
Handle : AA

%CAPITAL="%TOFNAME",

%Cursor


Quick Template 10. (This assumes that the addresses are present in the address book)

Description : Addressing for Friends
Handle : AF

%ABtoFIRSTNAME="%TOFNAME",

%Cursor

We now need to put all this together.

Quick Template 11.

Description : Final New Templates for Friends
Handle : FNTF

%Qinclude="AF"
%Qinclude="IS"
%Qinclude="LLNM"


Quick Template 12.

Description : Final New Templates for Others
Handle : FNTO

%Qinclude="AO"
%Qinclude="FS"
%Qinclude="LLNM"


Quick Template 13

Description : Final Reply Templates for Friends
Handle : FRTF

%Qinclude="AF"
%Qinclude="BRTQB"
%Qinclude="IS"
%Qinclude="LLRM"


Quick Template 14.

Description : Final Reply Templates for Others
Handle : FRTO

%Qinclude="AO"
%Qinclude="BRTQB"
%Qinclude="FS"
%Qinclude="LLRM"


We now have 4 final templates. These can be used in four places.

Account/Properties/Templates or
Folder/Properties/Templates or
Address Book/Group/Properties/Templates (probably the best place for them) or
Address Book/Address/Properties/Templates

What needs to be done is to put %Qinclude="Template Name" in the right places.

Sample greetings & cookies files can be downloaded from here.

Make sure that you save them in the directory referred to in the Quick Templates above - whatever you may have changed it to when transcribing for your own use.


[Back to top]

footer