 |
The Bat! Macro and Solutions Library |
 |
Back to
The Bat! FAQ /
How-Do-I
ActiveTimeZone [
Miscellaneous] |
Return seasonal time zone (to Version 2 w/ "mymacros" plugin
|
The ActiveTimeZone template will work only for a user who has BOTH READ
AND WRITE PRIVILEGES for the registry being read.
If the user does not have both privileges, this command
%RegRead(HKEY_LOCAL_MACHINE\SYSTEM\...\ActiveTimeBias)
returns an error message, and the ActiveTimeZone Quick Template returns
nothing at all.
If necessary, a member of the Administrator Group can run regedt32.exe and
change non-administrator users'
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
privileges to both read and right.
My thanks to Alexander Leschinsky and Andrew Aronoff, who helped me to
understand this.
This is the template:
%REM=' My thanks to Terry L Fritts and Januk Aggarwal
Used on Version 2 augmented by plugin from
http://en.barin.com.ua/soft/mymacros/
%QINCLUDEActiveTimeZone returns
my seasonally adjusted time zone,
EST (GMT-0500), or EDT (GMT-0400), as appropriate.
Change the template to agree with your time zone.
Note that %RegRead(HKEY ... \ActiveTimeBias)
will return the number of minutes by which
UTC differs from your computer's time of day '%-
%-
%IF(%-
%RegRead(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias)%-
="300","EST")%-
%-
%IF(%-
%RegRead(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias)%-
="240","EDT")%-
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 ]======
Boxquotes [
Miscellaneous] |
Paste as boxquote
|
Call bq to paste the clipboard into the editor as a boxquote. It makes
sense to create a keyboard shortcut to this function (see below for v2
version).
=====[ bq ]=====
%REM=' bq - Paste as Boxquote
written by Carsten Thoenges, December 2002
'%-
%If:+%-
%-%SetPattRegExp=&\A(ct,6567,,,TOH)&%-
%-%RegExpMatch=&%Comment&+<>+ct,6567,,,TOH+%-
:+%-
%-,----- [ %CURSOR ]%-
%-%COMMENT='%CLIPBOARD'%-
%-%IF:"%SETPATTREGEXP='(?is).*\n\z'%REGEXPMATCH='%COMMENT'"=""%-
:"%-
%-%-%COMMENT='%COMMENT
'"%-
%-%Comment=&ct,6567,,,TOH%COMMENT&%QInclude=&bq&%-
%-`-----+%-
:+%-
%-%IF:"%-
%-%SETPATTREGEXP='(?is)\A.*?\n(.*)'%-
%-%REGEXPMATCH='%COMMENT'"<>""%-
:"%-
%-%SETPATTREGEXP='(?is)\Act,6567,,,TOH(.*?)\n'%-
| %REGEXPMATCH='%COMMENT'%-
%-
%-%COMMENT='ct,6567,,,TOH%-
%-%SETPATTREGEXP=_(?is)\Act,6567,,,TOH.*?\n(.*)_%-
%-%REGEXPMATCH=_%COMMENT_'%-
%-%QINCLUDE='bq'"%-
:"| %SETPATTREGEXP=&\Act,6567,,,TOH(.*)&%-
%-%-%REGEXPMATCH=&%COMMENT&%-
%-%-%COMMENT=''"%-
+%-
=====[ End QT ]=====
**** Version 2 adaptation:
=====[ bq ]=====
%REM=' bq - Paste as Boxquote
written by Carsten Thoenges, December 2002
June 2003 - use new features of v2
'%-
%_TopAndTail="-----"%-
%_TopCorner=","%-
%_BottomCorner="`"%-
%_Side="| "%-
%_TitleFormat=" [ %CURSOR ]"%-
%-
%If:+%_FirstTime+=++:+%-
%___%_FirstTime="No"%-
%___%_TopCorner%_TopAndTail%_TitleFormat
%___%_Text="%Clipboard"%-
%___%SetPattRegExp='(?is)(\n)\z'%-
%___%If:"%RegExpMatch(%_Text)"="":"%_Text='%_Text
'"%-
%___%QInclude(bq)
%___%_BottomCorner%_TopAndTail%-
+:+%-
%___%SetPattRegExp='(?is)\A(.*?)\n(.*\n)\z'%-
%___%RegExpBlindMatch(%_Text)%-
%___%If:"%Subpatt(2)"<>"":"%-
%______%_Side%SubPatt(1)%-
%______%_Text='%Subpatt(2)'
%______%QInclude(bq)%-
%___":"%-
%______%_Side%_Text%-
%______%_FirstTime=''"%-
=====[ End QT ]=====
Clean Subject [
Reply template] |
Tidy up wayward subjects for replies
|
%REM=_
I don't remember who originally wrote this one but it's worth presenting here
_%-
%setpattregexp='(?i)\A\:?(\s*\[.*\])%-
?(\s*(aw|antw|antwort|betrifft|fw|fwd|forw|ha|rcpt|re|wg|wtr)%-
([\(\[]\d*[\)\]])?:\s*)*(.*?)%-
(\s?(\(PGP|S/MIME) Decrypted\)%-
|(\s?\(was:.*\))%-
)?$'%-
%RegExpBlindMatch(%OFullSubj)%-
%subject="Re: %SubPatt(5)"
And here's a v2 re-write, courtesy of Daniel Hahler
%_______%REM="clean subject - by daniel hahler"%________%-
%_oldSubj=%OSubj%-
%Subject="%-
%SetPattRegExp='(?ix)\A:?
( [([]+ .*? [)\]]+ )*\s* # save topic/listname
(?:
(?:
(?:aw|antw|antwort|betrifft|fw|fwd|forw|
forward|ha|rcpt|re\^?\d*|sv|vs|wg|wtr)(?:\[\d*\])?:
)
|\s+
)*
(.*?) # the subject
\s*
(
([(\[]+
( (wa[rs][:; ] | pgp | s/mime ).*
| fwd
)
[)\]]*\s*
)*
)\z'%-
%RegExpBlindMatch='%OSubj'%-
%IF:#%SubPatt='1'#<>##:#%SubPatt='1' #%-
Re: %SubPatt='2'"%-
%___________________________________
Date Translation [
Data extraction] |
Convert original sender's message date to longer format (can be modified for translation to other languages or formats).
|
See below for v2 adaptation
=====[ Date ]=====
%COMMENT='%-
%REM="Do the translation of the weekday"%-
%Comment="%-
%-%-%SETPATTREGEXP=_(?im-s)^Date\:.*(Sun|Mon|Tue|Wed|Thu|Fri|Sat)_%-
%-%-%REGEXPMATCH=_%Headers_"%-
%-
%IF:"%Comment"="Sun":"Sunday":""%-
%IF:"%Comment"="Mon":"Monday":""%-
%IF:"%Comment"="Tue":"Tuesday":""%-
%IF:"%Comment"="Wed":"Wednesday":""%-
%IF:"%Comment"="Thu":"Thursday":""%-
%IF:"%Comment"="Fri":"Friday":""%-
%IF:"%Comment"="Sat":"Saturday":""'%-
%-
%IF:'%COMMENT'<>'':'%COMMENT, '%-
%-
%REM="Do Month translation"%-
%Comment="%-
%SETPATTREGEXP='(?im-s)^Date\:.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'%-
%REGEXPMATCH='%Headers'"%-
%-
%IF:"%Comment"="Jan":"January":""%-
%IF:"%Comment"="Feb":"February":""%-
%IF:"%Comment"="Mar":"March":""%-
%IF:"%Comment"="Apr":"April":""%-
%IF:"%Comment"="May":"May":""%-
%IF:"%Comment"="Jun":"June":""%-
%IF:"%Comment"="Jul":"July":""%-
%IF:"%Comment"="Aug":"August":""%-
%IF:"%Comment"="Sep":"September":""%-
%IF:"%Comment"="Oct":"October":""%-
%IF:"%Comment"="Nov":"November":""%-
%IF:"%Comment"="Dec":"December":"" %-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{1,2})\s"%-
%REGEXPMATCH="%HEADERS", %-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{4})"%-
%REGEXPMATCH="%Headers"%-
%-
%COMMENT=""%-
=====[End QT]=====
**** Version 2 adaptation:
=====[ Date ]=====
%_DayForm='%-
%REM="Do the translation of the weekday"%-
%_Extract="%-
%-%-%SETPATTREGEXP=_(?im-s)^Date\:.*(Sun|Mon|Tue|Wed|Thu|Fri|Sat)_%-
%-%-%REGEXPMATCH=_%Headers_"%-
%-
%IF:"%_Extract"="Sun":"Sunday":""%-
%IF:"%_Extract"="Mon":"Monday":""%-
%IF:"%_Extract"="Tue":"Tuesday":""%-
%IF:"%_Extract"="Wed":"Wednesday":""%-
%IF:"%_Extract"="Thu":"Thursday":""%-
%IF:"%_Extract"="Fri":"Friday":""%-
%IF:"%_Extract"="Sat":"Saturday":""'%-
%-
%IF:'%_DayForm'<>'':'%_DayForm, '%-
%-
%REM="Do Month translation"%-
%_Extract="%-
%SETPATTREGEXP='(?im-s)^Date\:.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'%-
%REGEXPMATCH='%Headers'"%-
%-
%IF:"%_Extract"="Jan":"January":""%-
%IF:"%_Extract"="Feb":"February":""%-
%IF:"%_Extract"="Mar":"March":""%-
%IF:"%_Extract"="Apr":"April":""%-
%IF:"%_Extract"="May":"May":""%-
%IF:"%_Extract"="Jun":"June":""%-
%IF:"%_Extract"="Jul":"July":""%-
%IF:"%_Extract"="Aug":"August":""%-
%IF:"%_Extract"="Sep":"September":""%-
%IF:"%_Extract"="Oct":"October":""%-
%IF:"%_Extract"="Nov":"November":""%-
%IF:"%_Extract"="Dec":"December":"" %-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{1,2})\s"%-
%REGEXPMATCH="%HEADERS", %-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{4})"%-
%REGEXPMATCH="%Headers"%-
=====[End QT]=====
De-Base64 [
Filter] |
Unravel Base64 messages without Content Encoding headers
|
Copy the filter to the clipboard.
Open the sorting office.
Open "Incoming message" filters and move the cursor into the list.
Paste.
'DeBase64' will now exist as a filter.
You may need to modify the execution path for thebat.exe if yours doesn't
match the default. You may also wish to modify the location of the temporary
export file, which I have specified here as 'C:\Temp\export.msg'.
You will certainly have to modify the default account name, which I have
specified as (your account).
===================== Filter starts here
BeginFilter
Name: DeBase64
Active: 1
Source: \Inbox
Target: \Inbox
MainSet: 00@
Actions: faExport,faExternal,faoExportOver,faoManualOnly,faoHotKey
ExtCmd: C:\Program Files\The Bat!\thebat.exe /IMPORTU=(your account);
F=Inbox;I="C:\Temp\export.msg"
ExtFile: C:\Temp\export.msg
SaveTemplate: Content-Transfer-Encoding:\20base64\0D\0A%Headers\0D\0A
%Text\0D\0A\0D\0A
EndFilter
Edit a Received Message [
Filter] |
Editing received messages without changing the headers.
|
Two manual filters, and a batch command are required here.
One filter is for exporting the message and opening it in your favourite
text editor.
The other involves importing the message back to TB! in a folder of your
choice.
Exporting your message filter:
BeginFilter
Name: Export for editing
Active: 1
Source: \Inbox
Target: \Inbox
CopyFolder: \\\\none
MainSet: 40'e'
Actions: faExport,faExternal,faoExportOver,faoHotKey,faoSaveUnix
ExtCmd: "C:\Program Files\TextPad\textpad.exe" C:\temp\edit.txt
ExtFile: C:\temp\edit.txt
ColourGroup: <default>
AddAddrItems: afiFrom,
DelAddrItems: afiFrom,
HotKey: 0
IsOfColour: <default>
EndFilter
Import your message filter
BeginFilter
Name: Import after editing
Active: 1
Source: \Inbox
Target: \Inbox
CopyFolder: \\\\none
MainSet: 40'e'
Actions: faExternal,faoRunDetached,faoManualOnly,faoWaitCompletion,faoHotKey
ExtCmd: c:\batch-cmds\import.bat
ColourGroup: <default>
AddAddrItems: afiFrom,
DelAddrItems: afiFrom,
HotKey: 49225
IsOfColour: <default>
EndFilter
Batch file import.bat:
"C:\Program Files\The Bat!\thebat.exe" /IMPORTF="Imports";X;IN=C:\temp\edit.txt;R
Filter Chinese Spam [
Filter] |
Filter spam mails with unknown languages
|
Create a new filter for incoming mails and enable regular expressions. Now
insert the following as filter string:
(?ims)\A.{0,150}[\s\W\t\f\r\n]{20,}
(?ims) = ignore case / multiline / a dot scans newlines too
\A = search from the beginning
.{0,150} = scan only the first 150 chars from the mail (sometimes there is
crap at the end of normal mails e.g. signatures)
[\s\W\t\f\r\n]{20,} = min. 20 special chars (chinese)
I hope i do not forgot something...
Achim
Filter Collection [
Filter] |
Kill 95% of your spam messages
|
Firstly you should activate the Known filter so that you do not move or
delete messages from your friends... If you use services like ebay or
receive newsletters create a filter to keep such messages into your Inbox
folder, because most of them appear to be spam to the spam filters.
The following example filters ebay messages (sorry - I have used the german
ebay...):
BeginFilter
Name: Spam: EBay Mails
Active: 1
Source: \Inbox
Target: \Inbox
CopyFolder: \\\\none
MainSet: 00@ebay.(de|com)
AltSet:1: 20Kaufabwicklung
AltSet:2: 20Fragen.*Verkaeufer
Actions: faoRegExp,faSetColor
ColourGroup: EBay
EndFilter
Be sure that you replace YOURMAILACCOUNT with your account name and that
you created a folder called Spam within the Inbox Folder.
Now a filter for medical problems:
BeginFilter
Name: Spam: Medical
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 50(?ims)Lose.{0,25}Weight
AltSet:1: 50Reverse.{0,25}Aging
AltSet:2: 50Change Your Life
AltSet:3: 50(?ims)Younger
AltSet:4: 50Pills?
AltSet:5: 50Diet
AltSet:6: 50Weight Loss
AltSet:7: 50Pharmacy
AltSet:8: 50Feel Young
AltSet:9: 50Medication
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for porno mails:
BeginFilter
Name: Spam: Porn
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 50(Penis|Penís)
AltSet:1: 50Hardcore
AltSet:2: 50Sex
AltSet:3: 50Chat
AltSet:4: 50Video.{0,25}Botschaft
AltSet:5: 50Denke?.{0,5}An.{0,5}Dich
AltSet:6: 50Girl.?Friend
AltSet:7: 50Little Johnson
AltSet:8: 50Flirt
AltSet:9: 50Pussie
AltSet:10: 50Naked
AltSet:11: 50Cock
AltSet:12: 50Fetish
AltSet:13: 50Teen
AltSet:14: 50Live.?Cam
AltSet:15: 50Love (You|Me)
AltSet:16: 50V ?i ?a ?g ?r ?a
AltSet:17: 50Remember Me
AltSet:18: 50Webcam
AltSet:19: 50Porn
AltSet:20: 50Beautiful Women
AltSet:21: 50Enlargement
AltSet:22: 30Hot Action
AltSet:23: 50Video.?Tape
AltSet:24: 30Adult
AltSet:25: 50V(i|1){1,1}agra
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for money problems:
BeginFilter
Name: Spam: Money problems
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 50Paying.{0,25}Much
AltSet:1: 50Mortgage
AltSet:2: 30(?ims)Million.*Dollars?
AltSet:3: 50Mortage Rate
AltSet:4: 50Business Proposal
AltSet:5: 50Lower Payment
AltSet:6: 50(Big|Much|More|Grant) Money
AltSet:7: 50Jackpot
AltSet:8: 30Financial
AltSet:9: 30Monthly Payment
AltSet:10: 30Low.?Rates
AltSet:11: 30Wasting Money
AltSet:12: 30Compete.*Your Business
AltSet:13: 50Investment
AltSet:14: 50Income
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for mailing lists (this kills a lot of spam):
BeginFilter
Name: Spam: Mailing lists
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 30Stop Receiving
AltSet:1: 30Receiving Messages
AltSet:2: 30Remove Yourself
AltSet:3: 30Subscriber
AltSet:4: 30Mailing List
AltSet:5: 30Emails? From Us
AltSet:6: 30Remove Your Email
AltSet:7: 30Remove.{0,25}Subject List
AltSet:8: 30Unsubscribe
AltSet:9: 30Extracted Mailing
AltSet:10: 30No Mail
AltSet:11: 30(Off|From) (The|This) List
AltSet:12: 30To Be Removed
AltSet:13: 30Abzumelden
AltSet:14: 30(Erase|Delete) Your Email
AltSet:15: 30Eliminated From
AltSet:16: 30Future Mail(ing)?s
AltSet:17: 40List-Unsubscribe:
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for registrations and orders:
BeginFilter
Name: Spam:Registrations and orders
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 30Online Registration
AltSet:1: 30Credit Card
AltSet:2: 30Order Online
AltSet:3: 30To Order
AltSet:4: 50Get.{0,25}Free
AltSet:5: 50Free.{0,25}(Account|Shipping|Supply|Consultation|Software)
AltSet:6: 50Offers From Us
AltSet:7: 30Pricelist
AltSet:8: 30For Free
AltSet:9: 40Rapid Deals
AltSet:10: 30Sign Up
AltSet:11: 30Dienstleistung
AltSet:12: 30Limited.{0,25}Offer
AltSet:13: 30Money Back
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for unwanted contacts:
BeginFilter
Name: Spam: Contacts
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 30Please (Visit|Call)
AltSet:1: 30Enjoy It
AltSet:2: 30(Visit|Call|Send|Contact|Email) (Our|Us)
AltSet:3: 30(?ims)(Click(ing)?|Enter|Push|Continue).{0,8}(Here|Now|4)
AltSet:4: 30Klicken Sie
AltSet:5: 30For (More )?Information
AltSet:6: 30(Select|Activate|Click) (This|The) Link
AltSet:7: 30Click for More
AltSet:8: 30Check.{0,10}Out
AltSet:9: 30Visit This
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
A filter for virus tools:
BeginFilter
Name: Spam: Virus tools
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 50Blocking Spam
AltSet:1: 50(worm.*virus|virus.*worm)
AltSet:2: 50Virus Update
AltSet:3: 30Virus Protection
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
And now a filter for some other type of crap:
BeginFilter
Name: Spam: General
Active: 1
Source: \Inbox
Target: \Inbox\Spam
CopyFolder: \\\\none
MainSet: 50Cell ?Phone
AltSet:1: 50Casino
AltSet:2: 50Mobile Phones?
AltSet:3: 50Free (Auction|Tools?)
AltSet:4: 50Auction (Class|Tools)
AltSet:5: 50Cable Filters
AltSet:6: 30www\.lo7o\.com
AltSet:7: 50Descrambler?
AltSet:8: 30(?ims)\A.{0,150}[\s\W\t\f\r\n]{20,}
AltSet:9: 30(?ims)Private.*Confidential
AltSet:10: 00^.*(/d){4,}.*@
AltSet:11: 30(?ims)\A.{0,5}\z
AltSet:12: 30(?ims)(God | Jesus).*(Jesus | God)
AltSet:13: 20^.+(\s){5,}.+
Actions: faMarkRead,faoRegExp,faSetColor
ColourGroup: Spam
IsOfColour: Spam
EndFilter
The last filter has some special filters:
^.+(\s){5,}.+ = move messages with at least 5 spaces in the subject.
(?ims)\A.{0,5}\z = move messages with less than 5 chars as message text
(removes html only mails, because most of them are spam)
^.*(/d){4,}.*@ = move messages from senders with more than 4 digits in the
email address.
(?ims)\A.{0,150}[\s\W\t\f\r\n]{20,} = move chinese spam messages.
ftpmail request compose [
Miscellaneous] |
automate composing a request to ftpmail server
|
This macro, having ftp://ftp.site.com/dir/dir2/file.zip in Clipboard,
allows you to quickly compose a message like this:
To: ftpmail@ftp.sunet.se
~~~BODY~~~~
OPEN ftp.site.com anonymous your@email.here
CD dir
CD dir2
GET file.zip
~~~end BODY~~~
Here's the Version 1 macro - Version 2 macro follows below:
=====[FTPMail Template]=====
%Comment=""%Comment="%Clipboard"%-
OPEN%SetPattRegExp="\Aftp://([^/]+)/(.*)\Z"
%RegExpBlindMatch="%Comment"
%SubPatt="1" anonymous %FolderFromAddr
%Comment='%SetPattRegExp="\Aftp://([^/]+)/(.*)\Z"
%RegExpBlindMatch="%Comment" %SubPatt="2"'%-
%QInclude="bbb"
%To="ftpmail@ftp.sunet.se"
%SUBJECT="%Clipboard"
=====[End FTPMail Template]=====
Here is "bbb" quick template:
=====[ bbb ]=====
%If:"%SetPattRegExp='(/)'%RegExpMatch='%Comment'"="/":%-
"CD %SetPattRegExp='\A([^/]*)/'%RegExpMatch='%Comment'
%Comment=`%SetPattRegExp='\A[^/]*/(.*)\Z'%-
%RegExpMatch='%Comment'`%QInclude='bbb'":%-
"GET %Comment%Comment=''"
=====[End QT]=====
**** Version 2 adaptation:
=====[FTPMail Template]=====
%_ftp="%Clipboard"%-
OPEN%SetPattRegExp="\Aftp://([^/]+)/(.*)\Z"
%RegExpBlindMatch="%_ftp"
%SubPatt(1) anonymous %FolderFromAddr
%_ftp='%SetPattRegExp="\Aftp://([^/]+)/(.*)\Z"
%RegExpBlindMatch="%_ftp" %SubPatt(2)'%-
%QInclude="bbb"
%To="ftpmail@ftp.sunet.se"
%SUBJECT="%Clipboard"
=====[End FTPMail Template]=====
below is "bbb" quick template:
=====[ bbb ]=====
%If:"%SetPattRegExp='(/)'%RegExpMatch='%_ftp'"="/":%-
"CD %SetPattRegExp='\A([^/]*)/'%RegExpMatch='%_ftp'
%_ftp=`%SetPattRegExp='\A[^/]*/(.*)\Z'%-
%RegExpMatch='%_ftp'`%QInclude='bbb'":%-
"GET %_ftp"
=====[End QT]=====
Full name of month [
Miscellaneous] |
Translate the original send date to the format dd.mmmmm.yyyy
|
If you are using the english language, simply use the following line:
this is a forwarded mail from %OFROMFNAME %OFROMLNAME (%OFROMADDR)I got on %ODate="d.mmmm.yyyy"
If you are not, use the following macro and translate the text to the language of your choice.
this is a forwarded mail from %OFROMFNAME %OFROMLNAME (%OFROMADDR)I got on %ODATE="d. "%-
%IF:"%ODATE='m'"="1":"January":"%-
%IF:""%ODATE='m'""=""2"":""February"":"%-
%IF:"%ODATE='m'"="3":"March""":"%-
%IF:""%ODATE='m'""=""4"":""April"""":"%-
%IF:"%ODATE='m'"="5":"May""""":"%-
%IF:""%ODATE='m'""=""6"":""June"""""":"%-
%IF:"%ODATE='m'"="7":"July""""""":"%-
%IF:""%ODATE='m'""=""8"":""August"""""""":"%-
%IF:"%ODATE='m'"="9":"September""""""""":"%-
%IF:""%ODATE='m'""=""10"":""October"""""""""":"%-
%IF:"%ODATE='m'"="11":"November""""""""""":"%-
%IF:""%ODATE='m'""=""12"":""December"""""""""""""%-
%ODATE="yyyy" .
GMT offset [
Reply template] |
Find local computer's offset from GMT
|
Here's the Version 1 QTs - Version 2 QTs follow below:
=====[Begin TZOffset QT]=====
%Comment=`%Calc=~%-
%-
%REM=" Extract Hour and GMT offset "%-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{0,2})\:(\d{0,2})\:\d{0,2}\s.*?([-+])(\d{2})(\d{2})"%-
%REGEXPBLINDMATCH="%HEADERS"%-
%-
%REM=" Local hour - GMT hour (converted to minutes) "%-
%-
((%OTIME="hh" - (%SUBPATT="1" - (%SUBPATT="3"%SUBPATT="4")))*60 + %-
%-
%REM=" Local Minute - GMT minute "%-
%-
( %OTime="nn" - (%SUBPATT="2" - (%SUBPATT="3"%SUBPATT="5"))) + %-
%-
%REM=" Correct for straddling days in the different zones "%-
%-
%If:"%QInclude=_DateDiff_"="-6":"1":"%-
%If:'%QInclude=_DateDiff_'='6':'-1':'%-
%QInclude=_DateDiff_'" * (-24)*60)%-
%-
%REM=" Convert back to hhmm format "%-
%-
/60 * 100~`%-
%-
%REM=" Add lead + sign if necessary "%-
%-
%Comment="%-
%-%-%SetPattRegExp='^.*?([-+]\d*)$'%-
%-%-%RegExpMatch='+%Comment'"%-
%-
%REM=" Convert to standard notation for half hour timezones "%-
%If:"%-
%-%-%SetPattRegExp='(\d\d)$'%-
%-%-%RegExpMatch='%Comment'"="50":"%-
%-
%-%-%SetPattRegExp='^(.*)\d\d$'%-
%-%-%RegExpMatch='%Comment'%-
%-%-30":"%Comment"%-
%-
%Comment=''%-
=====[ End TZOffset QT]=====
=====[Begin DateDiff QT]=====
%CALC=_%-
%-
%-%-%Comment="%-
%-%-
%-%-%-%-%SetPattRegExp='(?im-s)^Date:.*(Sun|Mon|Tue|Wed|Thu|Fri|Sat)'%-
%-%-%-%-%RegExpMatch='%Headers'"%-
%-%-
%-%-%QInclude="DOW-Num" - %-
%-%-
%-%-%Comment="%ODate='ddd'"%-
%-%-
%-%-%QInclude="DOW-Num"_%-
%-
%Comment=""%-
=====[ End DateDiff QT]=====
=====[Begin DOW-Num QT]=====
%IF:"%Comment"="Sun":"1"%-
%IF:"%Comment"="Mon":"2"%-
%IF:"%Comment"="Tue":"3"%-
%IF:"%Comment"="Wed":"4"%-
%IF:"%Comment"="Thu":"5"%-
%IF:"%Comment"="Fri":"6"%-
%IF:"%Comment"="Sat":"7"%-
=====[ End DOW-Num QT]=====
**** Version 2 adaptation:
=====[Begin TZOffset QT]=====
%_Comment=`%Calc=~%-
%-
%REM=" Extract Hour and GMT offset "%-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{0,2})\:(\d{0,2})\:\d{0,2}\s.*?([-+])(\d{2})(\d{2})"%-
%REGEXPBLINDMATCH="%HEADERS"%-
%-
%REM=" Local hour - GMT hour (converted to minutes) "%-
%-
((%OTIME="hh" - (%SUBPATT="1" - (%SUBPATT="3"%SUBPATT="4")))*60 + %-
%-
%REM=" Local Minute - GMT minute "%-
%-
( %OTime="nn" - (%SUBPATT="2" - (%SUBPATT="3"%SUBPATT="5"))) + %-
%-
%REM=" Correct for straddling days in the different zones "%-
%-
%If:"%QInclude=_DateDiff_"="-6":"1":"%-
%If:'%QInclude=_DateDiff_'='6':'-1':'%-
%QInclude=_DateDiff_'" * (-24)*60)%-
%-
%REM=" Convert back to hhmm format "%-
%-
/60 * 100~`%-
%-
%REM=" Add lead + sign if necessary "%-
%-
%_Comment="%-
%-%-%SetPattRegExp='^.*?([-+]\d*)$'%-
%-%-%RegExpMatch='+%_Comment'"%-
%-
%REM=" Convert to standard notation for half hour timezones "%-
%If:"%-
%-%-%SetPattRegExp='(\d\d)$'%-
%-%-%RegExpMatch='%_Comment'"="50":"%-
%-
%-%-%SetPattRegExp='^(.*)\d\d$'%-
%-%-%RegExpMatch='%_Comment'%-
%-%-30":"%_Comment"%-
%-
%_Comment=''%-
=====[ End TZOffset QT]=====
=====[Begin DateDiff QT]=====
%CALC=_%-
%-
%-%-%_Comment="%-
%-%-
%-%-%-%-%SetPattRegExp='(?im-s)^Date:.*(Sun|Mon|Tue|Wed|Thu|Fri|Sat)'%-
%-%-%-%-%RegExpMatch='%Headers'"%-
%-%-
%-%-%QInclude="DOW-Num" - %-
%-%-
%-%-%_Comment="%ODate='ddd'"%-
%-%-
%-%-%QInclude="DOW-Num"_%-
%-
%_Comment=""%-
=====[ End DateDiff QT]=====
=====[Begin DOW-Num QT]=====
%IF:"%_Comment"="Sun":"1"%-
%IF:"%_Comment"="Mon":"2"%-
%IF:"%_Comment"="Tue":"3"%-
%IF:"%_Comment"="Wed":"4"%-
%IF:"%_Comment"="Thu":"5"%-
%IF:"%_Comment"="Fri":"6"%-
%IF:"%_Comment"="Sat":"7"%-
=====[ End DOW-Num QT]=====
Greet All Recipients [
Miscellaneous] |
Includes the first name of all recipients on the greeting line. Checks the address book for appropriate first name.
|
This version of the Greet_All_Recipients QT allows you to specify a
nickname or common name for the recipient in the Memo section of their
address book entry. This takes the form of a line starting with "aka: "
followed by the nickname. So if your friend Michael Rodent is generally
known as Mickey Mouse, his Memo entry might read:
Donald Duck's good friend
aka: Mickey Mouse
Likes cheese on his birthday
Where a nickname does not exist, the macro will use the person's first
name from the address book. If that does not exist, the macro will use
the first name from their email address.
====================== [ Greet_All_Recipients QT ] ======================
%REM="
Include firstnames of all recipients in greeting up to the maximum
number specified in %_GAR_Max
Written by Robin Anson 19 Oct 2003
Updated to allow familiar name to be stored anywhere in the AB memo
field as a single line of this form (without quotes):
'aka: nickname'
"%-
%-
%REM="
%_GAR_Max stores the maximum number of names you want in the greeting
line.
%_GAR_Default stores a default greeting to use when the message has
more than %_GAR_Max recipients
%_GAR_No is the number of names in the greeting.
%_GAR_Text stores the original list of recipients
%_GAR_Temp stores the list of recipients yet to be processed
%_GAR_To stores the greeting
%_GAR_NN stores the currently processed user's nickname (if any)
"%-
%-
%REM="
Adjust the %_GAR_Max and %GAR_Default values in the next lines to suit
your needs
"%-
%_GAR_Max=4%-
%_GAR_Default="Hi all,"%-
%-
%-%If:~%To~=~~::~%-
%If:#%_GAR_No#=##%-
:#%-
%_GAR_No="0"%-
%_GAR_Text=%ToList%-
%_GAR_Temp="%_GAR_Text,"%-
%_GAR_To=""%-
%QInclude(Greet_All_Recipients)#%-
:#%-
%IfN:~~%_GAR_No~~<=~~%_GAR_Max~~%-
:~~%-
%_GAR_No=%Calculate("%_GAR_No+1")%-
%If:'%setpattregexp="@"%regexpmatch="%_GAR_Temp"'<>''%-
:'%setpattregexp="(?i)^((?:.*?)@(?:.*?))(?:,|;)\s*(.*)?"%-
%regexpblindmatch="%_GAR_Temp"%-
%To=""%To=+%subpatt="1"+%-
%_GAR_Temp=+%Subpatt="2"+%-
%_GAR_NN="%SetPattRegexp=+(?im)^aka:\s*(.*?)$+%RegExpMatch=+%ABToMemo+"%-
%If:+%_GAR_NN+<>++%-
:+%_GAR_To="%_GAR_To%-%_GAR_NN, "+%-
:+%_GAR_To="%_GAR_To%-%Capital(%ABToFirstName=^%ToFName^), "+%-
%QInclude(Greet_All_Recipients)'%-
:'%_GAR_To'~~
:~~%_GAR_Default~~
%To=""%To="%_GAR_Text"%-
#~
==================== [ End Greet_All_Recipients QT ] ====================
Initials [
Reply template] |
Generate Initials more intelligently than TB's internal implementation
|
=====[Initials]=====
%SETPATTREGEXP="(?is)(\w).*?([-_=@\.\s]+(\w).*?)?([-_=@\.\s]+(\w).*?)?$"%-
%REGEXPBLINDMATCH="%QINCLUDE=""Full Name"""%-
%SUBPATT="1"%SUBPATT="3"%SUBPATT="5"%-
=====[ End QT ]======
=====[Full Name]=====
%CAPITAL='%ABofromNAME="%-
%QINCLUDE=_Full Name - No AB Entry_"'
=====[ End QT ]=====
=====[Full Name - No AB Entry]=====
%SETPATTREGEXP="^(?(?=.*?\@)(.*?)\@|(.*)$)"%-
%REGEXPBLINDMATCH="%OFROMNAME"%-
%SUBPATT="1"%SUBPATT="2"%-
=====[cEnd QT ]=====
Language Selection [
Reply template] |
Choose the language template automatically
|
First you have to create two templates, one for english and one for another
language. In my example i created a template for german (Handle=GReply) and
for english (Handle=EReply).
Now insert the following into your standard reply template:
%IF:"%REGEXPTEXT='(?ims)\A.{0,150} (the) '"="the":"%QINCLUDE='EReply'":"%-
%IF:_%REGEXPTEXT='(?ims)\A.{0,150} (is) '_=_is_:_%QINCLUDE='EReply'_:_%-
%IF:&%REGEXPTEXT='(?ims)\A.{0,150} (this) '&=&this&:&%QINCLUDE='EReply'&:&%-
%IF:+%REGEXPTEXT='(?ims)\A.{0,150} (or) '+=+or+:+%QINCLUDE='EReply'+:+%-
%IF:*%REGEXPTEXT='(?ims)\A.{0,150} (a) '*=*a*:*%QINCLUDE='EReply'*:*%-
%IF:#%REGEXPTEXT='(?ims)\A.{0,150} (i) '#=#i#:#%QINCLUDE='EReply'#:#%-
%QINCLUDE='GReply'#*+&_"
If you want to add more strings, copy one of the IF lines and be sure that
you use another delimiter which was not used before! Then add this delimiter
to the last line too!!!
This template scans only the first 150 chars + the length of the searchstring
for english words. This happens because sometimes people use signatures of a
different language at the end of the mail.
Achim
Local timezone [
Reply template] |
Show the sender's time in his zone and mine
|
On%SETPATTREGEXP="(?m-s)Date\:\s*?((.*?[\d]{4})\s*?%-
([\d]%-{0,2}\:[\d]{0,2})\s*?(.*))"%-
%REGEXPMATCH="%HEADERS" GMT%-
(%ODateShort, %OTime +0700 GMT), %OFROMNAME wrote:
(you need to adjust +0700 GMT to your own timezone)
MSGID [
General Macro] |
Include the Message ID in a message body
|
mid:%SETPATTREGEXP="<(.*)>"%REGEXPMATCH="%OMSGID"%-
Mssg & header editor [
Filter] |
Edit received emails (including header info)
|
This filter/batch file combo will export the high-lighted email to a text
file for editing then reimported the edited email message to the inbox.
The filter exports the file and starts the batch file which calls your text
editor and then calls The Bat! to do an import.
Alter the parameters below in [brackets] to suit your configuration. The
filter, as is, looks for the batch file to be:
c:\progra~1\thebat~1\editmsg.bat.
The batch file:
===============
start /max /wait c:\temp\edit.txt
REM The filter exports the mssg as c:\temp\edit.txt
REM /wait tells the batch file to not do anything
REM else until this process is ended.
REM /max says run in a maximized window.
REM There is no text editor called here because my file
REM associations already will invove my editor by just
REM opening the file itself.
REM If you wanted to call a particular editor your line
REM could read
REM start /max /wait "c:\windows\notepad.exe" c:\temp\edit.txt
"c:\progra~1\thebat~1\thebat.exe" /importu=[ACCOUNTNAME];f="[FOLDER]";X;R;IN=c:\temp\edit.txt
REM Substitute [ACCOUNTNAME] & [FOLDER] to tell TB! where you want to import to.
Copy the filter below (everything from, to and including the BeginFilter &
EndFilter lines) and paste it (CTRL-V) into your open sorting office.
Substitue REAL folder names where specified below.
The filter:
===============
BeginFilter
Name: Revise Message
Active: 1
Source: \Inbox
Target: \Inbox
MainSet: 00
Actions: faExport,faExternal,faoExportOver,faoRunDetached,faoManualOnly,
faoHotKey,faoHKCheckMsg,faoSaveUnix,faoHotKeyOnly
ExtCmd: c:\progra~1\thebat~1\editmsg.bat
ExtFile: c:\temp\edit.txt
HotKey: 57413
EndFilter
And, for version 3 of The Bat!, use this filter:
====================8<=====================================================
$$$$ TB! Message Filter $$$$
beginFilter
UID: [4A5D8A64.01C4A341.7AB167DC.09F13D53]
Name: ManEdit
Filter: {\0D\0A\20`21\0D\0A}
ExportMessage Kludges OverwriteExist FmtRFC822 filename C:\5Ctemp\5CMessage2Edit.txt
RunExternal Wait CmdLine C:\5CProgram\20File\5CThe\20Bat!\5CMessage2Edit.bat
IsActive
IsHotkey
IsHotkeyOnly
endFilter
====================8<=====================================================
Outlook L&F [
Reply template] |
Emulate Outlook Reply look & feel.
|
This template gives a tidy alternative to the default reply template.
- If To: or Cc: were blank on the original mail then these are suppressed
- Sent date preserves the sender's date format and timezone because I find
this more intuitive for the person to whom you are replying
- Also preserves timezone of original mail.
- Only tested with TheBat! v2.04.7
When pasting this template, please ensure there are no line breaks on lines
ending with the character %
Other line breaks are intentional.
--- 8< -------------------------------------
%Cursor
-----Original Message-----
From: %OFromName <%OFromAddr>
Sent%-
%VARdate='%SetPattRegExp="^Date:.*?$"%RegExpMatch=%HEADERS'%-
%SetPattRegExp=":.*$"%RegExpMatch="%VARdate"
%SetPattRegExp="^To:.*?$"%IF:"%RegExpMatch=%HEADERS"<>"":"To: %OToList
":""%-
%SetPattRegExp="^Cc:.*?$"%IF:"%RegExpMatch=%HEADERS"<>"":"Cc: %OCcList
":""%-
Subject: %OSubj
%Quotes
--- 8< -------------------------------------
Example:
-----Original Message-----
From: Fred Flintstone <fredf@bedrock.com>
Sent: Tue, 2 Mar 2004 02:24:33 -0800
To: "Barney Rubble" <barneyr@bedrock.com>
Subject: Yabba dabba doo!
.
.
.
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'"
Quote Extraction [
Reply template] |
Create quotes minus ads, PGP sigs, etc.
|
%QUOTES='%SETPATTREGEXP="(?is)%-
((\s*)?\n?-----BEGIN PGP SIGNED.*?\n(Hash:.*?\n)?\s*)?%-
(\s*(Dear|Hi|Hello|Hey|Greetings|Howdy) \S*?\s*\n+)?%-
(-+[\S ]+\n)?%-
(.*?)(^(%-
- -*?\s*?--\s*\n|%-
_{40,}\s*\n|%-
-{40,}\s*\n|%-
\n-----BEGIN PGP SIGNATURE.*s?\n|%-
--+\s+.*roups.*~--\>)|%-
\n\nYour use of|%-
\n+Get your FREE download|%-
\nNote that the email address of the sender has been changed|%-
\n---\nOutgoing mail is certified Virus Free.|%-
\z)"%REGEXPBLINDMATCH="%text"%SUBPATT="7"'
Re-threading in TB 3.x [
Procedure] |
Threading repair using New Filtering System
|
Adding and removing message from a thread is simplified due to new filtering
system introduced in 3.0 version of The Bat!. These operations work nearly
in the same manner as in earlier version, but now they are more reliable and
give possibility to re-thread any kind of messages (i.e. with or without
attachments, or multiple messages at once).
'Add_Reference' filter adds message to thread using following procedure:
1. Copy Message-Id to clipboard (including triangle brackets) of the message
which will be referenced to.
2. Select the message (or messages) which should be inserted into thread.
3. Run manually 'Add_Reference' filter using pre-defined key.
4. Move modified message which appeared in Inbox to appropriate folder.
The filter adds "References:" and "In-Reply-To:" fields to the message
header in several steps. First it exports original message to the file
"C:\Temp\Unix_Msg.txt" using Unix mailbox format. Due to such format the
entire structure of the message can be exported as a plain text file. This
file is used as the source for second action, i.e., exporting modified text
into second file "C:\Temp\export.msg". Modification of message is achieved
by following template:
%_OldMsg(%Put="C:\Temp\Unix_Msg.txt")%-
%SetPattRegExp="(?ismU)(.*)(^Subject:.*\s*.*\n)(\w.*?)"%RegexpBlindMatch(%_OldMsg)%-
%Subpatt(1)%Subpatt(2)In-Reply-To: %Clipboard
References: %Clipboard
%Subpatt(3)%-
The resulting message stored in "C:\Temp\export.msg" file is then imported
in Unix format into Inbox folder using following command line:
C:\Program Files\The Bat!\thebat.exe /IMPORTF=INBOX;X;I="C:\Temp\export.msg"
Original message without references is removed into common Trash folder.
Below is the 'Add_Reference' filter ready for copy and paste into read
messages filter group. You should assign a keyboard shortcut to it, and
probably want to modify file paths and names. They are used in several
places in filter actions (also in first line of exporting template).
$$$$ TB! Message Filter $$$$
beginFilter
UID: [A07FE8E0.01C478BF.6BE0C190.13BA8BD5]
Name: Add_Reference
Filter: {\0D\0A\20`0`0`@\0D\0A}
MoveMessage folder \5C\5C\5CTrash
ExportMessage OverwriteExist FmtUnix filename C:\5CTemp\5CUnix_Msg.txt
ExportMessage OverwriteExist FmtText filename C:\5CTemp\5Cexport.msg
template %_OldMsg(%Put\3D\22C:\5CTemp\5CUnix_Msg.txt\22)%-
\0D\0A%SetPattRegExp\3D\22(?ismU)(.*)(^Subject:.*\5Cs*.*\5Cn)(\5Cw.*?)\22
%RegexpBlindMatch(%_OldMsg)%-\0D\0A%Subpatt(1)%Subpatt(2)In-Reply-To:\20
%Clipboard\0D\0AReferences:\20%Clipboard\0D\0A%Subpatt(3)%-\0D\0A
RunExternal Wait CmdLine C:\5CProgram\20Files\5CThe\20Bat!\5Cthebat.exe\20
/IMPORTF\3DINBOX;X;I\3D\22C:\5CTemp\5Cexport.msg\22
IsManual
IsActive
IsHotkey
IsSendQueue
endFilter
In the above filter definition the text beginning from 'ExportMessage
OverwriteExist FmtText' and ending with '%Subpatt(3)%-\0D\0A' is one line,
similar to the text between 'RunExternal' and 'export.msg\22' phrases.
'Remove_Reference' filter works in similar way. It removes message out of the
thread due to deleting "References:" and "In-Reply-To:" fields from original
message header. It requires only selecting of the message on the list and
pressing keyboard shortcut. Modified message will appear in Inbox folder and
original will move into common Trash. The main difference is in exporting
template in filter action:
%_OldMsg(%Put="C:\Temp\Unix_Msg.txt")%-
%SetPattRegExp="(?ismU)(.*)(^References:.*\s*.*\n)(\w.*?)"%RegexpBlindMatch(%_OldMsg)%-
%_NewHeader="%Subpatt(1)%Subpatt(3)"%-
%SetPattRegExp="(?ismU)(.*)(^In-Reply-To:.*\s*.*\n)(\w.*?)"%RegexpBlindMatch(%_NewHeader)%-
%Subpatt(1)%Subpatt(3)
%SetPattRegExp="(?ism)\n\n(.*)"%RegexpMatch(%_OldMsg)%-
Notice the empty line before last one is significant! Here is the
'Remove_Reference' filter ready for use:
$$$$ TB! Message Filter $$$$
beginFilter
UID: [A07FE8E0.01C478BF.700A45BD.1A1954B6]
Name: Remove_Reference
Filter: {\0D\0A\20`0`0`@\0D\0A}
MoveMessage folder \5C\5C\5CTrash
ExportMessage OverwriteExist FmtUnix filename C:\5CTemp\5CUnix_Msg.txt
ExportMessage OverwriteExist FmtText filename C:\5CTemp\5Cexport.msg
template %_OldMsg(%Put\3D\22C:\5CTemp\5CUnix_Msg.txt\22)
%-\0D\0A%SetPattRegExp\3D\22(?ismU)(.*)(^References:.*\5Cs*.*\5Cn)(\5Cw.*?)\22
%RegexpBlindMatch(%_OldMsg)%-\0D\0A%_NewHeader\3D\22%Subpatt(1)%Subpatt(3)\22%-
\0D\0A%SetPattRegExp\3D\22(?ismU)(.*)(^In-Reply-To:.*\5Cs*.*\5Cn)(\5Cw.*?)\22
%RegexpBlindMatch(%_NewHeader)%-\0D\0A%Subpatt(1)%Subpatt(3)\0D\0A\0D\0A
%SetPattRegExp\3D\22(?ism)\5Cn\5Cn(.*)\22%RegexpMatch(%_OldMsg)%-\0D\0A
RunExternal Wait CmdLine C:\5CProgram\20Files\5CThe\20Bat!\5Cthebat.exe\20
/IMPORTF\3DINBOX;X;I\3D\22C:\5CTemp\5Cexport.msg\22
IsManual
IsActive
IsHotkey
IsCheckRule
IsHotkeyOnly
IsSendQueue
endFilter
Here the same line wrapping occurs as in 'Add_Reference' filter definition,
so please use text editor to correct this before copy and paste into The Bat!
Keyboard shortcut, path and file names in filter actions should be modified
according to individual needs.
Recipient list [
Data extraction] |
Reformat list of recipients into a vertical list. Can be modified to list only names or only addresses.
|
This is the recursive engine. Because it uses the %COMMENT macro, it has a
TB V2 variant (listed below). You can feed it any recipient list that ends
with a semi-colon and a space.
=====[Begin recipient2]=====
%REM='
Recipient List reformating routine.
recipient2 = recursive engine QT
Written by Januk Aggarwal
June 2002
Update: August 2002
'%-
%-
%IF:'%-
%SETPATTREGEXP=$(?i)^((\"?)(.*?)\2\s*(<.*?>)?\s*[;,]\s*)?$%-
%REGEXPMATCH=$%COMMENT$'<>'':'%-
%-
%SETPATTREGEXP=$(?i)^((\"?)(.*?)\2\s*(<.*?>)?\s*[;,]\s*)?$%-
%REGEXPBLINDMATCH=$%COMMENT$%-
%-
%REM=$ Insert Name $%-
%SUBPATT=$3$ %-
%REM=$ Insert Address $%-
%SUBPATT=$4$
%-
%COMMENT=_%-
%-%-%SETPATTREGEXP=$(?i)^((\"?)(.*?)\2\s*(<.*?>)?\s*[;,]\s*)?(.*)$%-
%-%-%REGEXPBLINDMATCH=$%COMMENT$%-
%-%-%SUBPATT=$5$_%-
%-
%QINCLUDE="recipient2"'%-
=====[ End recipient2]=====
Here is a driver template. This is the one you'd %QInclude into your main
template. Note this example will list all recipients of the current message.
=====[QT recipient]=====
%COMMENT="%-
%-%-%IF:'%TOLIST'<>'':'%TOLIST, ':''%-
%-%-%IF:'%CCLIST'<>'':'%CCLIST, ':''%-
%-%-%IF:'%BCCLIST'<>'':'%BCCLIST, ':''%-
"%-
%QINCLUDE="recipient2"%-
%COMMENT=""%-
=====[End]=====
-=-=-=-= All New Recipient List for v2 -=-=-=-=-
The recipient list reformatting template is a general purpose template that
can be used on it's own, or in conjunction with other templates. This template
will convert a comma/semicolon separated list into a list with each entry on
it's own line.
To convert a list from the clipboard, simply copy your text to the clipboard,
type "Recipient_List" (no quotes) followed by <ctrl><space> in the editor.
When called from a template, the calling template should put the text to be
reformatted in %_RL_Text before the wrap template is called. There is also
an optional indent space parameter, %_RL_Num_Space if a certain indent is
desired. The following two templates are: a sample print template and its
driver template.
=====[Begin example print QT]=====
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
From: %FromName <%FromAddr>
Date: %ODateEn %OTimeLongEn %IF:'%TOLIST'<>'':'
To: %_RL_Text="%TOLIST; "%QINCLUDE="recipient driver"' %IF:'%CCLIST'<>'':'
Cc: %_RL_Text="%CCLIST; "%QINCLUDE="recipient driver"' %IF:'%BCCLIST'<>'':'
Bcc: %_RL_Text="%BCCLIST; "%QINCLUDE="recipient driver"'
Subject: %FullSubj
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
%text
-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=====[ End example print QT]=====
=====[Begin Recipient Driver QT]=====
%_RL_Num_Space("10")%-
%SetPattRegexp="^(?s)\s{%_RL_Num_Space}(.*)\Z"%-
%RegExpMatch="%-
%___%QInclude='Recipient List'"%-
=====[ End Recipient Driver QT]=====
=====[Begin Recipient_List QT]=====
%REM='
Recipient List reformatting routine using features from TB v2
Written July 2003 by Januk Aggarwal
Notes:
1. This template can be used alone to reformat clipboard
contents or can be used as a reformatting engine by
assigning text to the variable, %_RL_Text, in the driver
template.
2. Indenting can be specified by defining number of leading
spaces in %_RL_Num_Space variable.
'%-
%-
%IF:'%_RL_FirstTime'='':'%-
%___%IF:"%_RL_Text"="":"%_RL_Text(""%Clipboard; "")"%-
%___%IF:"%_RL_Num_Space"!="":"%-
%______%SetPattRegexp=""(\s{%_RL_Num_Space})""%-
%______%RegExpBlindMatch="" ""%-
%______%_RL_Leading_Space(%SubPatt(1))":"%-
%______%_RL_Leading_Space()"%-
%___%_RL_FirstTime="No"'%-
%-
%IF:'%_RL_Text'!='':'%-
%-
%___%SetPattRegexp=!(?x)
^\s* # Strip Leading Spaces
( # SubPatt 1 - First Item + Delimiter
( # SubPatt 2 - First Item
(\"?) # Opening Quotation marks
(.*?) # SubPatt 4 - Name
\3 # Closing Quotation marks if opening ones exist
\s*
(\<.*?\>)? # SubPatt 5 - Address
) # Close First Item
\s*[;,]\s* # Delimiter and white space
) # Close First Item + Delimiter
(.*) # SubPatt 6 - Remainder of list
\Z!%-
%___%RegexpBlindMatch(%_RL_Text)%-
%-
%___%_RL_Name_Addr(%SubPatt(2))%-
%___%_RL_Name(%SubPatt(4))%-
%___%_RL_Addr(%SubPatt(5))%-
%___%_RL_Text(%SubPatt(6))%-
%-
%___%_RL_Leading_Space%-
%___%If:%_RL_Name!="":"%_RL_Name "%-
%___%_RL_Addr
%-
%QInclude("Recipient_List")'%-
=====[ End Recipient_List QT]=====
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]=====
Rethread messages [
Procedure] |
Make or break threads for messages in folders
|
Here are a couple of special filters to help with two related problems that
arise when using a threaded mail client like TB.
The first filter is called Add_Reference. This filter is to thread an
orphaned reply message to the message to which it is a reply.
ToDo: First copy these filters to Notepad or SmartBat and tidy them up.
You must make sure that the "Actions:" and "SaveTemplate:" values are pasted
as a single line of text and not wrapped as they appear here. Copy the tidied
up filter to the clipboard and then paste it into your sorting office using
Ctrl-V. It is best to put these filters into the "Read messages" section.
BeginFilter
Name: Add_Reference
Active: 1
Source: \\Inbox
Target: \\Inbox
CopyFolder: \\\\none
MainSet: 00@
Actions: faDelMsg,faExport,faExternal,faoExportOver,
faoManualOnly,faoHotKey,faoHKCheckMsg,faoAdvNoAttach
ExtCmd: "C:\Program Files\The Bat!\thebat.exe" /IMPORT;F=Inbox;I="C:\Temp\export.msg"
ExtFile: C:\Temp\export.msg
HotKey: 49234
SaveTemplate: %IF:_%SETPATTREGEXP\3D\22(?is)(References:.*?\5C>)
\22%REGEXPMATCH\3D\22%HEADERS\22_\3D__:_%-\0D\0A
%IF:#%SETPATTREGEXP\3D\22(?is)(In-Reply-To:.*?\5C>)
\22%REGEXPMATCH\3D\22%HEADERS#\3D##:#%-\0D\0A%HEADERS\0D\0A
%TEXT%-\0D\0A#:#%-\0D\0A%SETPATTREGEXP\3D\22(?is)(.*)\5Cn
(In-Reply-To:.*?\5C>)\5Cn(.*)\22%-\0D\0A
%REGEXPBLINDMATCH\3D\22%HEADERS\22%SUBPATT\3D\221\22\0D\0A
%SUBPATT\3D\223\22\0D\0A%TEXT%-\0D\0A#_:_\0D\0A
%SETPATTREGEXP\3D\22(?is)(.*)\5Cn(References:.*?\5C>)\5Cn(.*)
\22%-\0D\0A%REGEXPBLINDMATCH\3D\22%HEADERS\22%SUBPATT\3D\221\22\0D\0A
%SUBPATT\3D\223\22\0D\0A%TEXT_%-\0D\0A\0D\0A
EndFilter
This filter can be used to repair threads broken by (for instance) Outlook
Express.
Before using this filter, you must first load up the Windows clipboard with
a copy if the message ID from the message [1] you want to thread the
orphaned message to. To do this, select the message [1] and (either) view
the source (F9) of the message (or) turn on 'kludge' view (Ctrl-Shift-K).
Find the header line that says "Message ID: <blahxxxxxx@1234567.domain>".
This is the message ID you're looking for. Mark the ID (from the '<' to
the '>' inclusive) and press Ctrl-C to copy it to the clipboard.
Now select the message you want to re-thread and activate the filter by using
the <Ctrl-Alt-R> combination.
A new version of the message will be created in your inbox. Move it to the
folder and, as if by magic, there it is, nicely threaded.
--------------------------------------------------
The next filter is used to break threads at a point of your choosing.
Sometimes a thread changes direction in the middle or gets re-titled or
maybe someone who doesn't know about threading replies to a message in the
middle of the thread with a completely different topic. For whatever reason,
you now need to separate the sub-thread from the main root. This filter lets
you do it.
This filter is activated with the <Shift-Ctrl-Alt-R> key combo. Just point
to a message in a thread that you want to make into the head of a brand new
thread and press the hotkey.
BeginFilter
Name: Remove_Reference
Active: 1
Source: \\Inbox
Target: \\Inbox
CopyFolder: \\\\none
MainSet: 00@
Actions: faDelMsg,faExport,faExternal,faoExportOver,faoManualOnly,faoHotKey
ExtCmd: "C:\Program Files\The Bat!\thebat.exe" /IMPORT;F=Inbox;I="C:\Temp\export.msg"
ExtFile: C:\Temp\export.msg
HotKey: 57426
SaveTemplate: %SETPATTREGEXP\3D\22(.*\5Cn?)(In-Reply-To:?)|(References:?)\22%-
\0D\0A%REGEXPBLINDMATCH\3D\22%HEADERS\22%subpatt\3D\221\22%-
\0D\0A%SETPATTREGEXP\3D\22(?is)(.*\5Cn?)(In-Reply-To:|References:)[^:]*?\5Cn%-
\0D\0A([\5Cw\5Cd\5C-]*:\20.*)\5Cn\22%REGEXPBLINDMATCH\3D\22%HEADERS\22%subpatt\3D\223\22%-
\0D\0A%TEXT%-\0D\0A
EndFilter
In both cases the original message is removed, but this feature may be
changed (switching off the appropriate option in the filter configuration
window). Of course, even if the message is deleted, it may be revisited
using the "Browse deleted messages" function before compressing the folder.
Both filters should be placed into "Read messages" group.
ReWrap [
Reply template] |
Recursively wrap quoted reply text
|
You have to create the following quick templates (handles are in
[brackets]). Because it uses the %COMMENT macro, it has a TB V2 variant
(listed below):
=====[ Begin wq ]=====
%COMMENT="%QUOTES"%-
%QINCLUDE="wrap2"
%COMMENT=""
=====[ End wq ]=====
=====[ 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 ]=====
Replace the %QUOTES macro in your reply template with
%QINCLUDE="wq". That should do it.
Do what?
Well, this macro will take the text from the message to which you wish to
reply and paste it into the reply as quotes, one line at a time and wrapping
each line as it goes. This avoids the problem of having too long lines in
your quotes.
For example ... before:
This is the text I want to reply to and as you can see it's all in one long
line of text.
... and after:
> This is the text I want to reply to and as you can
> see it's all in one long line of text.
-=-=-=-=-=-=-= All New Wrap for v2 -=-=-=-=-=-=-
The multi-paragraph wrapping template is a general purpose template that
can be used on it's own, or in conjunction with other templates.
To wrap and insert text from the clipboard, simply copy your text to the
clipboard, type "wrap" (no quotes) followed by <ctrl><space> in the editor.
When called from a template, the calling template should put the text to be
wrapped in %_Wrap_Text before the wrap template is called. There is also an
optional wrap length parameter, %_Wrap_Limit if a certain column length is
desired. The following is an example driver template that will wrap quoted
text to 50 characters.
=====[Begin example driver]=====
%_Wrap_Text="%Quotes"%-
%Rem="This line is optional"%___%_Wrap_Limit="50"%-
%QInclude(wrap)%-
=====[ End example driver]=====
=====[Begin wrap template]=====
%REM='
Multi-Paragraph wrapping routine using features from TB v2
Written June 2003 by Januk Aggarwal
Notes:
1. This template can be used alone to wrap clipboard
contents or can be used as a wrapping engine by assigning
text to the variable, %_Wrap_Text, in the driver template.
2. Wrapping limit can be set optionally by defining the
variable %_Wrap_Limit in the driver template
'%-
%-
%IF:'%_Wrap_FirstTime'='':'%-
%___%IF:"%_Wrap_Text"="":"%_Wrap_Text(%Clipboard)"%-
%___%_Wrap_FirstTime="No"'%-
%-
%IF:'%-
%SetPattRegexp="(?is-m)[^\n]+"%-
%RegexpMatch(%_Wrap_Text)'<>'':'%-
%-
%SetPattRegexp="(?is-m)^(.*?)((\n((\w{0,5}(\>\s*)+)?\s*\n)+)(.*)\s*$|\z)"%-
%RegexpBlindMatch(%_Wrap_Text)%-
%-
%_Wrap_Paragraph_1(%Subpatt(1))%-
%_Wrap_Blank_Space(%Subpatt(3))%-
%_Wrap_Remainder_Of_Text(%Subpatt(7))%-
%-
%If:"%_Wrap_Limit"="":"%-
%____%Wrapped(%_Wrap_Paragraph_1)":"%-
%____%Wrapped(%_Wrap_Limit, %_Wrap_Paragraph_1)"
%_Wrap_Text(%_Wrap_Remainder_of_Text)%-
%-
%QInclude(wrap)'%-
=====[ End wrap template]=====
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!
Search and Replace [
Miscellaneous] |
Replaces arbitrary texts within the %COMMENT macro/variable
|
%REM=' replace - Replaces all occurrences of FROM with TO in %COMMENT
written by Carsten Thoenges, April 2003
Usage:
%COMMENT="FROM;TO;FROM BE OR NOT FROM BE"
%QINCLUDE="replace"
%COMMENT
-> TO BE OR NOT TO BE
'%-
%IF:'%SETPATTREGEXP="\A(.*?);(.*?);(.*?)(\1)"%-
%-%REGEXPBLINDMATCH="%COMMENT"%SUBPATT="4"'<>''%-
:'%-
%-%COMMENT=_%-
%-%-%SETPATTREGEXP="\A(.*?);(.*?);(.*?)(\1)(.*?)\Z"%-
%-%-%REGEXPBLINDMATCH="%COMMENT"%-
%-%-%SUBPATT="1";%SUBPATT="2";%SUBPATT="3"%SUBPATT="2"%SUBPATT="5"_%-
%-%QINCLUDE="replace"'%-
:'%-
%COMMENT="%SETPATTREGEXP=_\A(?:.*?;.*?;)(.*)\Z_%REGEXPMATCH=_%COMMENT_"'%-
**** Version 2 adaptation:
%REM=' replace - Replaces all occurrences of FROM with TO in %_TEXT
written by Carsten Thoenges, April 2003
adapted for v2 by Marck, Oct 2003
Usage:
%_TEXT="FROM;TO;FROM BE OR NOT FROM BE"
%QINCLUDE="replace"
%_TEXT
-> TO BE OR NOT TO BE
'%-
%IF:'%SETPATTREGEXP="\A(.*?);(.*?);(.*?)(\1)"%-
%-%REGEXPBLINDMATCH="%_TEXT"%SUBPATT="4"'<>''%-
:'%-
%-%_TEXT=#%-
%-%-%SETPATTREGEXP="\A(.*?);(.*?);(.*?)(\1)(.*?)\Z"%-
%-%-%REGEXPBLINDMATCH="%_TEXT"%-
%-%-%SUBPATT="1";%SUBPATT="2";%SUBPATT="3"%SUBPATT="2"%SUBPATT="5"#%-
%-%QINCLUDE="replace"'%-
:'%-
%_TEXT="%SETPATTREGEXP=#\A(?:.*?;.*?;)(.*)\Z#%REGEXPMATCH=#%_TEXT#"'%-
Sender Date [
Data extraction] |
Change original sender date format to dd/mm/yyyy
|
This template will return a formatted date, based on the message's date of
creation. Because it uses the %COMMENT macro, it has a TB V2 variant
(listed below). It will take the Date: field from the message header and
return a string containing dd/mm/yyyy. You can use the returned date to
include it in the new message text or to further analyse it with %IF macros
or the like.
--------------------- Begin template --------------
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{1,2})\s"%-
%REGEXPMATCH="%HEADERS"/%-
%-
%REM="Do Month translation"%-
%Comment="%-
%SETPATTREGEXP='(?im-s)^Date\:.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'%-
%REGEXPMATCH='%Headers'"%-
%-
%IF:"%Comment"="Jan":"01":""%-
%IF:"%Comment"="Feb":"02":""%-
%IF:"%Comment"="Mar":"03":""%-
%IF:"%Comment"="Apr":"04":""%-
%IF:"%Comment"="May":"05":""%-
%IF:"%Comment"="Jun":"06":""%-
%IF:"%Comment"="Jul":"07":""%-
%IF:"%Comment"="Aug":"08":""%-
%IF:"%Comment"="Sep":"09":""%-
%IF:"%Comment"="Oct":"10":""%-
%IF:"%Comment"="Nov":"11":""%-
%IF:"%Comment"="Dec":"12":""/%-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{4})"%-
%REGEXPMATCH="%Headers"%-
%-
%COMMENT=""%-
--------------------- End template --------------
**** Version 2 adaptation:
--------------------- Begin template --------------
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{1,2})\s"%-
%REGEXPMATCH="%HEADERS"/%-
%-
%REM="Do Month translation"%-
%_dat="%-
%SETPATTREGEXP='(?im-s)^Date\:.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)'%-
%REGEXPMATCH='%Headers'"%-
%-
%IF:"%_dat"="Jan":"01":""%-
%IF:"%_dat"="Feb":"02":""%-
%IF:"%_dat"="Mar":"03":""%-
%IF:"%_dat"="Apr":"04":""%-
%IF:"%_dat"="May":"05":""%-
%IF:"%_dat"="Jun":"06":""%-
%IF:"%_dat"="Jul":"07":""%-
%IF:"%_dat"="Aug":"08":""%-
%IF:"%_dat"="Sep":"09":""%-
%IF:"%_dat"="Oct":"10":""%-
%IF:"%_dat"="Nov":"11":""%-
%IF:"%_dat"="Dec":"12":""/%-
%-
%SETPATTREGEXP="(?im-s)^Date\:.*?\s(\d{4})"%-
%REGEXPMATCH="%Headers"%-
--------------------- End template --------------
Smart Addressing [
Miscellaneous] |
If there is only one receiver in To list, address him by first name. If there is more than one, address them as all.
|
This template helps you get the greeting right at the top of the message
when there are more than one recipients.
--------------------- Begin template --------------
%IF:"%SETPATTREGEXP='(?is)(.*?),'%-
%REGEXPBLINDMATCH='%TOLIST'%-
%SUBPATT='1'"="":%-
"Hi %CAPITALFIRST='%ABtoFIRSTNAME=#%TOFNAME#',":%-
"Hello all,"
%CURSOR
--------------------- End template --------------
The output of this macro depends on the number of recipients.
If there is only one (let's say it's our old friend Fred Newman), the output is:
Hi Fred,
NB: It is 'Hi Fred' even if he put his name as 'fred' (no capital). And if
you have Fred Newman in your address book, then it will be 'Hi Fred'
even if he forgot to put his name or wrote to you as 'Noreen Newman'.
If there are more than one recipients, then the greeting starts with
Hello all,
You can replace the standard "Hi %tofname" macro with this one.
Smart Quote Prefixing [
Miscellaneous] |
To use initials with quote prefixes only if the recipient e-mail client supports it.
|
1) Create a quick template with the handle name 'prefix' (name is without
the quotation marks). In the quick template copy and paste the following
macro exactly as shown:
--------------------- Begin template --------------
%IF:"%SETPATTREGEXP='(?im-s)^X-Mailer\:.*(Bat!|Becky).*$'%-
%REGEXPBLINDMATCH='%HEADERS'%-
%SUBPATT='1'"="":"none":"I"
--------------------- End template --------------
2) In your reply template the following macro must precede your %quotes macro:
%Quotestyle="%Qinclude='prefix'"
The result of using this macro is that any quoted text in a reply will be
prefaced by the sender's initials, but only if the message was sent from a
TB or a Becky! user. Only TB and Becky! can understand such prefixed lines
as quotations.
SpamCop submission [
Filter] |
Automatically submit a spam message to SpamCop
|
ToDo: First copy these filters to Notepad or SmartBat and tidy them up. You
will have to specify your own SpamCop spam submission address in the "forward
message" action option. You must also make sure that the "Actions:" are
pasted as a single line of text and not wrapped as they appear here. Copy
the tidied up filter to the clipboard and then paste it into your sorting
office using Ctrl-V.
===================== Filter starts here
BeginFilter
Name: Submit spam to SpamCop
Active: 0
Source: \Inbox
Target: \Trash
CopyFolder: \\\\none
MainSet: 40.
Actions: faMarkRead,faNewMsg,faExport,faoExportOver,faoExportKludges,
faoManualOnly,faoHotKey,faoSaveUnix
NewAddr: submit.ShusJmC3eoSbRk41@spam.spamcop.net
NewTemplate: %put\3D\27C:\5Ctemp\5Cexport.txt\27\0D\0A
ExtFile: C:\temp\export.txt
HotKey: 49235
SaveTemplate: \0D\0A
EndFilter
Then - there is what happens when the notification comes back from SpamCop
that the reports are ready to process. You can automate the procedure with
the following filter. You may need to change the launcher (which refers to
IE) if IE is not your preferred browser.
***NEW***: This version of the procedure now logs into your SpamCop account
too. You will have to change the "name%%%%40domain.com:password" text to be
your account name and password. Oh yes, the %%%%40 is an "@" sign in
macro+batch file encoding.
Once again, copy these filters to Notepad or SmartBat and tidy them up
before pasting them into the sorting office. The one to pay special
attention to here is the SaveTemplate command, which should not have
any line breaks.
===================== Filter starts here
BeginFilter
Name: SpamCop AutoResponder
Active: 1
Source: \Inbox
Target: \Trash
MainSet: 00spamcop.net
MainSet: 20SpamCop has accepted
Actions: faMarkRead,faExport,faExternal,faoExportOver,faoWaitCompletion
ExtCmd: C:\temp\spamcop.bat
ExtFile: C:\temp\spamcop.bat
SaveTemplate: \22c:\5CProgram\20Files\5CInternet\20Explorer\5CIEXPLORE.EXE\22\20%-
\0D\0Ahttp://name%%%%40domain.com:password@members.%-
\0D\0A%REGEXPTEXT\3D\22spamcop.net/sc\5CS*\22\0D\0Acls\0D\0A
EndFilter
If you are a user of the free service, you don't need to log in. Here's a
version of that filter for you folks.
Once again, copy these filters to Notepad or SmartBat and tidy them up
#before pasting them into the sorting office. The one to watch again is
the SaveTemplate command.
===================== Filter starts here
BeginFilter
Name: SpamCop AutoResponder
Active: 1
Source: \Inbox
Target: \Trash
MainSet: 00spamcop.net
MainSet: 20SpamCop has accepted
Actions: faMarkRead,faExport,faExternal,faoExportOver,faoWaitCompletion
ExtCmd: C:\temp\spamcop.bat
ExtFile: C:\temp\spamcop.bat
SaveTemplate: \22c:\5CProgram\20Files\5CInternet\20Explorer\5CIEXPLORE.EXE\22\20%-
\0D\0Ahttp://%REGEXPTEXT\3D\22spamcop.net/sc\5CS*\22\0D\0Acls\0D\0A
EndFilter
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 --------------
WebBoard Mail List [
Reply template] |
Format and clean up messages destined for a WebBoard mail list
|
TB_WB_RT - Date: 04-26-2004
~~~~~~~~
The Bat! 2.xx.xx reply template for use with WebBoard mail lists.
What it does:
~~~~~~~~~~~~
WebBoard allows (sysop discretion) email subscriptions to its topics
to facilitate a somewhat crude mail list functionality.
Unlike 'real' list servers there is some kinks which can make email
use cumbersome. The template below basically cleans up formats a reply
that is better suited for the WebBoard.
Line 4: strips off RE: from the subject
Lines 5-7: store complete sender info from body to TMP1
Lines 8-10: store quoted sender name from body to TMP2
Line 11: store friendly name to FM
Line 12: perform only basic quote prefixing
Lines 13-14: generate quote author/time stamp
Lines 15-17: WebBoard footer/attachments to remove
Line 19: strip matches of 15-17 from quote text
I've been using this with a WebBoard 6.1 and so far the template does
all that I needed. This may not be suitable for other versions of
WebBoard.
How I use this:
~~~~~~~~~~~~~~
I've a common folder which has all the incoming WebBoard traffic
sorted into. Further sorting, topic/list name I am doing with virtual
(children of the common folder) folders.
The common folder 'template' is %blank and the reply template is as
listed below.
New messages to the WebBoard list(s) are handled with address book
templates.
The WebBoard requirement, AFAIK, is simply that the REPLY-TO address be
matching the address that is part of the WebBoard account profile.
The first 3 lines obviously should reflect your own account and email
address.
------------------8<--------------------
%ACCOUNT=[xxx]%-
%FROM="xxx <xxx@xxx.xxx>"%-
%REPLYTO="xxx <xxx@xxx.xxx>"%-
%SUBJECT="%SUBJECT"%-
%SETPATTREGEXP="((^From:\s)(.*?)(\n))"%-
%REGEXPBLINDMATCH="%TEXT"%-
%VARTMP1=%SUBPATT="3"%-
%SETPATTREGEXP='(^From:\s"(.*?)")'%-
%REGEXPBLINDMATCH="%TEXT"%-
%VARTMP2=%SUBPATT="2"%-
%IF:%VARTMP2<>"":%VARFM="%VARTMP2":%VARFM="%VARTMP1"%-
%QUOTESTYLE="NONE"%-
On%SETPATTREGEXP="(?m-s)Date\:\s*?((.*?[\d]{4})\s*?([\d]{0,2}\:[\d]{0,2})\s*?(.*))"%-
%REGEXPMATCH=[%HEADERS] GMT, %VARFM wrote:
%VAR_FM="From:\s.*?\n"%-
%VAR_AT="--\nAttachment:\n.*\n"%-
%VAR_FT="To\sreply:\s.*\n"%-
%CURSOR%-
%QUOTES='%SETPATTREGEXP="(?is)(^(%VAR_FM))?(.*?)(^(%VAR_AT|%VAR_FT))"%-
%REGEXPBLINDMATCH="%TEXT"%SUBPATT="3"'%-
--
%FromName
------------------8<--------------------
I welcome any comments or improvements on the template. If I get any
knowledge of WebBoard 7.x and the template needs changes I'll try to
remember to update this here. In any event I'll add any improvements
to my site:
The Starving Hedonist
X-Mailer Extractor [
Data extraction] |
Extracting X-Mailer headers from Headers
|
This is a template macro used to extract the X-Mailer header.
It works best as a quick template (call it XM) that you can then use
elsewhere with the %QINCLUDE='XM' command so that you can make more complex
decisions based on it.
--------------------- Begin template --------------
%SETPATTREGEXP="(?im-s)^(X-Mailer|User-Agent):\s*(.*)$"%-
%REGEXPBLINDMATCH="%Headers"%-
%Subpatt="2"
--------------------- End template --------------
When you run this template, it returns values such as:
The Bat! (v1.61) Personal
Microsoft Outlook Express 6.00.2600.0000
Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
eGroups-EW/0.82
Forte Agent 1.8/32.553
Yahoogroups Digest macro [
Reply template] |
Replace the "Re: Digest number xxxx" in the subject with the original subject of the individual email
|
copy and paste the macro.
when replying, highlight parts of the email from the word "From:" until the
end of the email that you want to quote. the macro will automatically
replace the standard subject ("Re: Digest Number xxxx") with the original
subject from the individual email and also tidy up the subject a little bit.
Feel free to modify this code :)
%subject="Re: %setpattregexp='Subject:(\s*(re|ha|rcpt|fwd|fw)\s?%-
(\[\d*\])?:\s*)*(.*?)\n(.*)'%-
%RegExpBlindMatch='%Quotes'%SubPatt='4'"
%setpattregexp="(\[.*\])\s(.*)"%-
%RegExpBlindMatch="%OSubj"%-
==== Information from %SubPatt="2" ====
%setpattregexp="(\s)?From:\s\W?(.*?)\W?\s(<.*?>)\n%-
(.*)Subject:(.*?)\n(.*)"%-
%RegExpBlindMatch="%Quotes"%-
Once upon a time, %SubPatt="2" wrote:
%SubPatt="6"
Copyright © 1996 - 2004 Marck D. Pearlstone
Last Updated 15th-October-2009