On Thu, 22 Jun 2006 at 11:14:12 +0200, Roelof wrote:
> Oops! Sorry Robin for adapting your name.

I've had far worse! :-)

Yes, I use the memo field for storing data for which there is not
another spot. I could reuse an existing field, but that doesn't
appeal to me. So I set up attributes between pairs of tags thus:

<aka>Jim</aka>
<closing>Regards</closing>
<receipts>read delivery</receipts>

To retrieve those values I use a macro called Get_Memo_Attribute which
looks like
---[Start 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"+'%-

----[End Get_Memo_Attribute]----

As described in the macro, you call it from another macro or template
by using something like

%QInclude(Get_Memo_Attribute,"closing","Yours Sincerely")

In the example above it would return "Regards". If there was not an
attribute between a starting tag <closing> and an ending tag
</closing>, it would return "Yours Sincerely".

You can also assign the value to a temporary variable by using

%_temp=%QInclude(Get_Memo_Attribute,"closing","Yours Sincerely")

Is that useful?

-- 
Robin

Using The Bat! v3.80.06
      Windows XP 5.1 Build 2600 Service Pack 2
      Popfile v0.22.4



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

Reply via email to