Hi Nick,

Historians believe that Fri, 1 Jun 2001 at 08:33 GMT -0500 was when,
Nick Danger [ND] typed the following:

<snip>
ND> I'm trying to set up a macro to first see if there is any text in
ND> %ABOFromMemo (that's where I enter any nicknames I use for certain
ND> people - internet aliases, etc.).

You don't need a %IF macro to do this.  The %AB macros have a default
value option: %ABofromMEMO="...".  If there is no memo, then "..." is
used.

ND> If there is, then I want to use
ND> that.  If there is no text there then I want to check to see if there
ND> is an e-mail address in the From field instead of someone's name
ND> (checking for the "@" symbol).

Put the macro I gave you into a quick template.  I'll call it
"Salutation 2".  Then your main template would just be:

%ABofromMEMO="%QINCLUDE=""Salutation 2"""

The Salutation 2 QT would be:

%IF="%SETPATTREGEXP=""@""%REGEXPMATCH=""%OFROMNAME"""="@":"Default
Salutation":"%CAPITAL=""%OFROMNAME"""

<snip>

ND> Lastly (I hope) is there any rule of thumb for nesting syntax?

I'm not sure what you mean by "rule of thumb" in this case.  The best
way to think about these things is very slowly.  For complicated
nesting, try breaking it up into smaller bits, and see if you can put
them into QT's.  That really simplifies the ' and " business.

Here is an example I use in all my list postings:

My reply template has:
%QINCLUDE="QuoteStyle"

Where QuoteStyle is a QT containing:
%QUOTESTYLE='=%QINCLUDE="Initials"'

Initials is the following QT:
%SETPATTREGEXP="(?is)(\w).*?([-_=@\.\s]+(\w).*?)?([-_=@\.\s]+(\w).*?)?$"%-
%REGEXPBLINDMATCH="%QINCLUDE=""Full Name"""%-
%SUBPATT="1"%SUBPATT="3"%SUBPATT="5"%-

Full Name:
%UCFIRST='%ABofromNAME="%QINCLUDE=""Full Name - No AB Entry"""'

Full Name - No AB Entry:
%SETPATTREGEXP="^(?(?=.*?\@)(.*?)\@|(.*)$)"%-
%REGEXPBLINDMATCH="%OFROMNAME"%-
%SUBPATT="1"%SUBPATT="2"%-

As you can see, each bit is not too bad.  But imagine trying to put
that all into one big line.  The other advantage is I can use parts of
the macro elsewhere.  I don't need to rewrite anything for another
application. (See my intro to your message.)
 
-- 
Thanks for writing,
 Januk Aggarwal

Using The Bat! 1.53 Beta/11 under Windows 98 4.10 Build 2222  A

I was the next door kid's imaginary friend.

-- 
______________________________________________________
Archives   : <http://tbtech.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>

You are subscribed as : [email protected]


Reply via email to