 |
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")%-
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 ]=====
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" .
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 ] ====================
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#"'%-
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.
Copyright © 1996 - 2004 Marck D. Pearlstone
Last Updated 15th-October-2009