 |
The Bat! Macro and Solutions Library |
 |
Back to
The Bat! FAQ /
How-Do-I
Attachments listing [
General Macro] |
Reformat the listing of attachments
|
Create the following quick templates (handles are in [brackets] -
see below for v2 versions):
======[ AT1 ]========
%REM='written by Matthias Appel in oct. 2001'
%IF:"%ATTACHMENTS"="<none>":"":"Attachments:
%COMMENT='%ATTACHMENTS'%-
%QINCLUDE='at2'"%-
=====[ End QT ]======
======[ AT2 ]========
%IF:"%SETPATTREGEXP='(?i)^.*?(;).*$'%REGEXPMATCH='%COMMENT'"=";":"%-
%SETPATTREGEXP='(?i)^\s*(.*?)\s*;.*$'%REGEXPMATCH='%COMMENT'
%COMMENT='%SETPATTREGEXP=""(?i)^.*?;\s*(.*)\s*$""%REGEXPMATCH=""%COMMENT""'%-
%QINCLUDE='at2'":"%COMMENT%-
%COMMENT=''"%-
=====[ End QT ]======
After adding the attachments to your email you can write at1 and hit
<ctrl+space> to get the listing.
**** Version 2 adaptation:
======[ AT1 ]========
%REM='written by Matthias Appel in oct. 2001'
%IF:"%ATTACHMENTS"="<none>":"":"Attachments:
%_COMMENT='%ATTACHMENTS'%-
%QINCLUDE='at2'"%-
=====[ End QT ]======
======[ AT2 ]========
%IF:"%SETPATTREGEXP='(?i)^.*?(;).*$'%REGEXPMATCH='%_COMMENT'"=";":"%-
%SETPATTREGEXP='(?i)^\s*(.*?)\s*;.*$'%REGEXPMATCH='%_COMMENT'
%_COMMENT='%SETPATTREGEXP=_(?i)^.*?;\s*(.*)\s*$_%REGEXPMATCH=_%_COMMENT_'%-
%QINCLUDE='at2'":"%_COMMENT%-
%_COMMENT=''"%-
=====[ End QT ]======
MSGID [
General Macro] |
Include the Message ID in a message body
|
mid:%SETPATTREGEXP="<(.*)>"%REGEXPMATCH="%OMSGID"%-
Private Messages [
General Macro] |
Prevent wayward folder templates from sending a private message to a list.
|
This macro checks to see if you've clicked on a mailto link. If so, it
doesn't put in the list address. This is important, because you may not
have intended for the list to see what might be a private message to another
list member.
Put the below as a folder level macro on the TEMPLATE tab.
%IF:"%TOLIST%CCLIST%BCCLIST"="":"%TO='THE LIST POST ADDRESS'"
Recipient list -Indented [
General Macro] |
Reformat a comma/semicolon separated list to an indented vertical list
|
This one is complex. Because it uses the %COMMENT macro, it has a TB V2
variant (listed below). The main recursive engine is:
=====[Begin print_recipient2]=====
%REM='
Recipient List reformating routine.
recipient2 = recursive engine QT
Written by Januk Aggarwal
November 2002
'%-
%-
%IF:'%-
%SETPATTREGEXP=$(?i)^\d*\n(\"?(.*?)\"?\s*(\<.*?\>)?\s*[;,]\s*)$%-
%REGEXPMATCH=$%COMMENT$'<>'':'%-
%-
%SETPATTREGEXP="\s{%-
%-%-%SETPATTREGEXP=#^\d*#%-
%-%-%REGEXPMATCH=#%COMMENT#}"%-
%REGEXPMATCH=" "%-
%-
%SETPATTREGEXP=$(?i)^\d*\n((\"?(.*?)\"?\s*(\<.*?\>)?)\s*[;,]\s*)?$%-
%REGEXPBLINDMATCH=$%COMMENT$%-
%SUBPATT=$2$
%-
%COMMENT=_%-
%-%-%SETPATTREGEXP=$(?i)^(\d*\n)(\"?(.*?)\"?\s*(\<.*?\>)?\s*[;,]\s*)?(.*)$%-
%-%-%REGEXPBLINDMATCH=$%COMMENT$%-
%-%-%SUBPATT=$1$%-
%-%-%SUBPATT=$5$_%-
%-
%QINCLUDE="print_recipient2"'%-
=====[ End print_recipient2]=====
This recursive engine needs a driver template with the number of leading
spaces specified on the first line. An example is the following combination
of templates for printing:
=====[Begin print]=====
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
From: %FromName <%FromAddr>
Date: %ODateEn %OTimeLongEn %IF:'%TOLIST'<>'':'
To: %COMMENT="%TOLIST; "%QINCLUDE="print_recipient"' %IF:'%CCLIST'<>'':'
Cc: %COMMENT="%CCLIST; "%QINCLUDE="print_recipient"' %IF:'%BCCLIST'<>'':'
Bcc: %COMMENT="%BCCLIST; "%QINCLUDE="print_recipient"'
Subject: %Subj
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
%text
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=====[ End print]=====
The following driver template is an intermediate between the print template
and the recursive engine:
=====[Begin print_recipient]=====
%COMMENT="10
%COMMENT"%-
%SETPATTREGEXP="(?s-m)^\s{10}(.*)\n$"%-
%REGEXPMATCH="%QINCLUDE='print_recipient2'"%-
%COMMENT=""%-
=====[ End print_recipient]=====
**** Version 2 adaptation:
=====[Begin print_recipient2]=====
%REM='
Recipient List reformating routine.
recipient2 = recursive engine QT
Written by Januk Aggarwal Nov 2002
Modified for v2 by Marck Oct 2003
'%-
%-
%IF:'%-
%SETPATTREGEXP=$(?i)^\d*\n(\"?(.*?)\"?\s*(\<.*?\>)?\s*[;,]\s*)$%-
%REGEXPMATCH=$%_COMMENT$'<>'':'%-
%-
%SETPATTREGEXP="\s{%-
%-%-%SETPATTREGEXP=#^\d*#%-
%-%-%REGEXPMATCH=#%_COMMENT#}"%-
%REGEXPMATCH=" "%-
%-
%SETPATTREGEXP=$(?i)^\d*\n((\"?(.*?)\"?\s*(\<.*?\>)?)\s*[;,]\s*)?$%-
%REGEXPBLINDMATCH=$%_COMMENT$%-
%SUBPATT=$2$
%-
%_COMMENT=_%-
%-%-%SETPATTREGEXP=$(?i)^(\d*\n)(\"?(.*?)\"?\s*(\<.*?\>)?\s*[;,]\s*)?(.*)$%-
%-%-%REGEXPBLINDMATCH=$%_COMMENT$%-
%-%-%SUBPATT=$1$%-
%-%-%SUBPATT=$5$_%-
%-
%QINCLUDE="print_recipient2"'%-
=====[ End print_recipient2]=====
This recursive engine needs a driver template with the number of leading
spaces specified on the first line. An example is the following combination
of templates for printing:
=====[Begin print]=====
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
From: %FromName <%FromAddr>
Date: %ODateEn %OTimeLongEn %IF:'%TOLIST'<>'':'
To: %_COMMENT="%TOLIST; "%QINCLUDE="print_recipient"' %IF:'%CCLIST'<>'':'
Cc: %_COMMENT="%CCLIST; "%QINCLUDE="print_recipient"' %IF:'%BCCLIST'<>'':'
Bcc: %_COMMENT="%BCCLIST; "%QINCLUDE="print_recipient"'
Subject: %Subj
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
%text
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=====[ End print]=====
The following driver template is an intermediate between the print template
and the recursive engine:
=====[Begin print_recipient]=====
%_COMMENT="10
%_COMMENT"%-
%SETPATTREGEXP="(?s-m)^\s{10}(.*)\n$"%-
%REGEXPMATCH="%QINCLUDE='print_recipient2'"%-
%_COMMENT=""%-
=====[ End print_recipient]=====
ReWrap Clipboard Content [
General Macro] |
Recursively rewrap multiple paragraphs copied to your clipboard.
|
This is just a small modification of the macros for recursively wrapping
quoted text posted by Januk Aggarwal.
You have to create the following quick templates (handles are in
[brackets]):
=====[ Begin wc ]=====
%COMMENT="%Clipboard"%-
%QINCLUDE="wrap2"
%COMMENT=""
=====[ End wc ]=====
=====[ Begin wrap2 ]=====
%IF:''%-
%SETPATTREGEXP="(?is-m)[^\n]+"%-
%REGEXPMATCH="%COMMENT"''<>'''':''%-
%-
%WRAPPED=_%SETPATTREGEXP="(?is-m)^(.*?)(\n(((\w{0,5}(\>\s*)+)?\s*\n))+(.*)\s*$|\z)"%-
%-%-%-%-%-%REGEXPBLINDMATCH="%COMMENT"%-
%-%-%-%-%-%SUBPATT="1"_
%COMMENT=_%SETPATTREGEXP="(?is-m)^(.*?)(\n(((\w{0,5}(\>\s*)+)?\s*\n))+(.*)\s*$|\z)"%-
%-%-%-%-%-%REGEXPBLINDMATCH="%COMMENT"%-
%-%-%-%-%-%SUBPATT="7"_%-
%QINCLUDE="wrap2"''
=====[ End wrap2 ]=====
Now copy your text to your clipboard using CTRL-X, including multiple paragraphs as
needed, and then apply the quick template with handle ''wc'' by typing wc then
CTRL-<space>.
Enjoy!
ToAll [
General Macro] |
Convert current reply into a Reply to All
|
This macro is intended for use as a keyboard invoked Quick Template. Give it
a handle of 'ToAll'. It's for that moment when you have begun writing a
reply and halfway through you realize you should have done a 'Reply to all'
before you started. Type 'ToAll<Ctrl-Space>' and the CC field will be filled
with the missing addresses taken from the original message.
NB:
In the lines below are my two main email addresses.
Replace them with yours in the form
first@mydomain.com[|second@mydomain.com][|third@mydomain.com]
If you have only one address, just leave out the '|' characters and keep it
at one address.
--------------------- Begin template --------------
%CC='%SETPATTREGEXP=_^(.*?)[,;]?\s*$_%-
%REGEXPMATCH=_%-
%SETPATTREGEXP="^(.*?[,;]?)([^,;]*%-
(marck@silverstones.com|marck@brainstormsw.com)%-
[^,;]*[,;]?)(.*)$"%-
%REGEXPBLINDMATCH="%OTOLIST, %OCCLIST"%- %SUBPATT="1"%SUBPATT="4"_'
--------------------- End template --------------
Copyright © 1996 - 2004 Marck D. Pearlstone
Last Updated 15th-October-2009