This is OT for TBBETA, so I have copied it to TBUDL and TBOT too.

On Wed, 4 Mar 2009 at 11:21:47 +0100, Volker wrote:
>> I have found that it's relatively easy to set up macros to use the
>> Memo field to hold all sorts of useful information like that.
> 
> Hey, that sounds good to me! :-)
> 
>> For instance I use the following structure in a Memo field:
> 
>>    <aka>Joe</aka>
>>    <closing>Kind regards</closing>
>>    <closingname>Jack Black</closingname>
>>    <receipts>read delivery</receipts>
>>    <cc>jsm...@yahoo.com</cc>
>>    <bcc>trevor.tur...@company.com.au</bcc>
> 
> How would such a macro look like? – Thanks in advance.

As Miguel suggested, it relies on regex. So perhaps "relatively easy"
depends upon your desire to play around with regex!

The basic macro is very similar to the one that Maurice showed in
mid:1974229872.20090304125...@hypercube.demon.nl

The macro I use to extract the information from the memo field is

==== [ Macro: Get_Memo_Attribute ] ====
%Rem='

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

This will return the value from a line in the address book memo field
that looks like this:
   <tag>value</tag>

Or the "Default_Value" if no such line exists

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

I use this in a set of more complex macros that specify what information to
retrieve (by identifying the tag) and, if necessary, identifying a default
value so that I can deal with the case of no value being set.

The main complexity is that I have created macros that cater for a list of
multiple recipients. The macros will parse the list of recipients and
extract the attribute from each recipient's memo field and then take action
depending upon how many recipients have a value in the attribute, how many
different values there are, etc.

For instance, if one of the multiple recipients has a read or delivery
receipt set, it is applied to the message using this macro which recursively
processes each address in the recipient list.

==== [ Macro: SetReceipts ] ====
%REM=^%-

Set read or delivery receipt notification flags if the
recipient's addressbook memo entry contains an attribute with the tag
<receipts> with the value "read" or "delivery" respectively

^%-
%-
%REM="%-
%_SR_Text stores the original list of recipients
%_SR_Temp stores the list of recipients yet to be processed
%_RR_Flag is set to 1 if read receipt required
%_DR_Flag is set to 1 if delivery receipt required
"%-
%-
%If:#%_SR_FirstTime#=##%-
:#%-
%_SR_FirstTime="No"%-
%_SR_Text="%ToList"%-
%_SR_Temp="%_SR_Text"%-
%_RR_Flag="no"%-
%_DR_Flag="no"%-
%QInclude(SetReceipts)#%-
:#%-
%-
%REM="*** Parse the Recipient List ***"%-
%-
%If:'%setpattregexp="@"%-
%regexpmatch="%_SR_Temp"'<>''%-
:'%setpattregexp="(?i)^((?:.*?)@(?:.*?))(?:,|;)\s*(.*)?"%-
%regexpblindmatch="%_SR_Temp,"%-
%SetHeader(+To+,+%subpatt="1"+)%-
%_SR_Temp=+%Subpatt="2"+%-
%-
%-
%REM=" *** Get the receipt attribute *** "%-
%-
%_MemoAttribute=+%QInclude(Get_Memo_Attribute,"receipts","")+%-
%_RR_Flag=%If:+%SetPattRegExp="(?im).*Read"%RegExpMatch=%_MemoAttribute+<>++:+yes+:+%_RR_Flag+%-
%_DR_Flag=%If:+%SetPattRegExp="(?im).*Delivery"%RegExpMatch=%_MemoAttribute+<>++:+yes+:+%_DR_Flag+%-
%QInclude(SetReceipts)'%-
:'%-
%If:"%_RR_Flag"="yes":"%ReadConfirm":"%NoReadConfirm"%-
%If:"%_DR_Flag"="yes":"%RcptConfirm":"%NoRcptConfirm"%-
%SetHeader("To","%_SR_Text")#%-
==== [ End Macro ]====

Other macros I use set the name(s) in the greeting at the top  of  the
message, choose the sig used at the end of the message, allow me to
automatically add CC or BCC addresses, etc
-- 
Robin

Using The Bat! v4.1.11
      Windows XP 5.1 Build 2600 Service Pack 3
      Popfile v0.22.4


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

Reply via email to