On Wed, 8 Feb 2006 at 17:01:02 +0100, Roelof wrote:
> In the AB entry you've got to check the option 'add secondary
> addresses to BCC field' at the 'Others' tab
> Now you've got to create a new message from the AB, otherwise the
> option won't work.

This is where you can do useful things with macros and the memo field in an
addressbook entry.

I use my memo field to:
   * set greetings for people (so I have an addressbook entry for Joe Smith,
     but I can automatically start my email to him "Hey Cool Kat"
   * set closing of my emails (so an email to my daughter ends "Love, Dad"
     but one to my clients ends "Regards, Robin")
   * set read or delivery receipts so that I know when people receive and
     read my emails
   * set the account and signature that a person gets my email from, so that
     my boss never gets an email from my personal account with my personal
     sigfile

And recently I set up a macro that allows me to specify a secondary address
that always gets included in the CC field without needing to start from the
addressbook.

I set the following line in the memo field of the relevant addressbook entry

   <CC>[EMAIL PROTECTED]</CC>

and the line

   %Qinclude(Add_CC)%-

in all of my templates and then use the four macros listed below.

The reason there are several levels of macro is that I have a number of
different "FindTknType" macros (a middle level) that deal differently with
multiple entries on the address line so that I can handle an email to
multiple recipients properly.

,----- [ Add_CC ]
%REM="
   Include secondary addresses noted in memo field between <CC> tags.
   A token is identified by a line of the form:
   <CC>XXX</CC>

Usage:
   %QInclude(Add_CC)

   Written by Robin Anson 4 Dec 2005

"%-
%-
%REM="
   %_AddCC_List stores the original list of recipients
   %_AddCC_Temp stores the list of recipients yet to be processed
   %_AddCC_CC stores the CC list
"%-
%-
%rem=^   Initialise variables^%-
%_AddCC_Done="yes"%-
%_AddCC_List="%ToList"%-
%_AddCC_Temp="%_AddCC_List, %CCList"%-
%_AddCC_CC="%CCList"%-
%CC=""%-
%-
%_FTT_Status="0"%-
%QInclude(FindTknType0,"%_AddCC_Temp","CC","%_AddCC_CC")%-
%To=""%To="%_AddCC_List"%-
%CC="%_FindTkn_Text"%-
`-----

,----- [ FindTknType0 ]
%Rem='

FindTokenType0 returns a list of values of a single token from an XML
style entry in the memo fields of a list of address book entries.

The list contains the value for that token (if it exists) for each address
in the address list

Usage:
   %_FTT_Status="0"
   %QInclude(FindTknType0,"Address_list","Token","start_value")

Returns:
   %_FindTkn_Text

'%-
%_FT_AL="%_1"%-
%_FT_Token="%_2"%-
%_FT_start="%_3"%-
%If:|%_FT_AL|<>||%-
:|%If:"%_FTT_Status"="0"%-
:"%_FT_AlHold='%_1'%-
%_FTT_Status='1'%-
%_FindTkn_Text='%_FT_start'"%-
:""%-
%QInclude(ParseAddressList,"%_FT_AL")%-
%To=""%To="%_FirstAddress"%-
%_FT_AL="%_RemainingAddressList"%-
%_FT_TmpTxt="%QInclude(Get_Memo_Attribute,'%_FT_Token','%_FT_default')"%-
%If:^%_FT_TmpTxt^<>^^%-
:^%If:+%_FindTkn_Text+=++%-
:+%_FindTkn_Text='%_FT_TmpTxt'+%-
:+%If:/%SetPattRegexp='%_FT_TmpTxt'%RegexpMatch='%_FindTkn_Text'/=//%-
:/%_FindTkn_Text='%_FindTkn_Text, %_FT_TmpTxt'/://+^%-
:^^%-
%QInclude(FindTknType0,'%_FT_AL','%_FT_Token','%_FT_start')|%-
:||%-
`-----

,----- [ ParseAddressList ]
%Rem=^

Usage:
   %QInclude(ParseAddressList,"<ListOfAddresses>")

Returns:
   %_FirstAddress: first address from the list
   %_RemainingAddressList: address list without the first

^%-
%-
%_FirstAddress=""%-
%_RemainingAddressList=""%-
%If:'%_1'<>''%-
:'%setpattregexp="^([^;,]*)[;,\s]*(.*?)[;,\s]*$"%-
%regexpblindmatch="%_1"%-
%_FirstAddress=+%subpatt="1"+%-
%_RemainingAddressList=+%Subpatt="2"+'%-
:''%-
`-----

,----- [ Get_Memo_Attribute ]
%Rem='

Usage:
   <attribute value>=%QInclude(Get_Memo_Attribute,"Tag","Default_Value")

'%-
%If:'%SetPattRegExp="(?im)^<%_1"%RegExpMatch="%ABToMemo"'='':'%_2'%-
:'%If:+%SetPattRegExp="(?im)^(<%_1/>)"%RegExpMatch="%ABToMemo"+<>++:++%-
:+%SetPattRegExp="(?im)^(?:<%_1>)(.*?)(?:</%_1>)"%RegExpMatch="%ABToMemo"+'%-
`-----

--
Robin                                           
                                                
Using The Bat! v3.0.1.33                        
      Windows XP 5.1 Build 2600 Service Pack 2  
      Popfile v0.22.3                           


________________________________________________
Current version is 3.65.03 | 'Using TBUDL' information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to