Hallo Chris,

On Thu, 7 Dec 2006 13:52:59 -0600GMT (7-12-2006, 20:52 , where I
live), you wrote:

C> I have a number of text files of the following form:
C> HEADER LINE
C> Students: Name <e-mail address>,
C>           Name <e-mail address>
C> From: My Name <my e-mail address>
C> MORE TEXT

Rather odd text files. ;-)

C> Is there an easy way to have The Bat! read these files in, extract the
C> e-mail addresses, place them in the To: field, fill-in a subject, and
C> place the entire contents of the file in the body?

Sure, can be done. No problem whatsoever. But your subject says mail
merge and that's not quite same as what your asking for. A mail merge
(especially one using TB's mass mailing capabilities) would be
difficult/impossible.

C> I'm not scared of regular expressions, but I'm no wizard either.

I'm no wizard either, but here's my solution:

,----- [  ]
| %SetPattRegExp='(?is)(.*?)\nStudents:\s(.*?)\nFrom:\s(.*?)\n(.*)'%-
| %RegExpBlindMatch='%Put("C:\Temp\students.txt")'%-
| %To=""%To="%SubPatt='2'"%-
| %Subject="%SubPatt='1'"%-
| %From="%SubPatt='3'"%-
| %SubPatt='4'
`-----

In order to test it, I created a file C:\Temp\students.txt with
contents in your format and it worked like a charm.

A few notes.

I used your 'HEADER LINE' as subject, therefore it needs to be a
single line not starting with 'Students: ' as that string is the
separator I use to find where your addressees are listed. You can use
something else as source for the subject, that won't really break the
template.

A possible enhancement would be to make your students' addresses
invisible for each other by placing them in the BCC: header. In order
to do that you have to change the line:
%To=""%To="%SubPatt='2'"%-
into these two lines:
%To=""%To="%SubPatt='3'"%-
%BCC="%SubPatt='2'"%-
That will cause your own address to be placed in the To: header and
all other recipients in the BCC: header.

A definite restriction is that all recipients' addresses (except for
the last) need to be followed by an comma as TB needs that comma to
separate them.

Another restriction is that all addresses with a name with points need
to be enclosed between quotation marks, otherwise it would contain an
illegal dot in the name. Harvey L. Oswald <[EMAIL PROTECTED]> is an
illegal construct in an address header, while "Harvey L. Oswald" <[EMAIL 
PROTECTED]>
computes just fine.

I'm CC-ing this answer to tbtech as it's definitely too technical for
tbudl. Follow-ups need to go there too.

-- 
Groetjes, Roelof

"Windows 95: Making Windows work just like a Mac did 10 years ago!"
http://www.voormijalleen.nl/
The Bat! 3.86.8 ALPHA (beta)
Windows XP 5.1 Build 2600 Service Pack 2
1 pop3 account, server on LAN
OTFE enabled
P4 3GHz
2 GB RAM
________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to