Pages: 1
RSS
Auto-reply macro to properly capitalize names
 
After digging through these forums I finally found out how to extract a name and email address from emails that I receive, but then I got stuck when a name came in all capitals.

Looking for a way to correct it automatically.

So here's an example of part of an email I might get:



Sender
ALBERT EINSTEIN
albert@einstein.com




And for that, I use the following macros to generate an automated reply:




%To=""%To="%SetPattRegExp='(?is)(.*?)Sender\n(.*?)\n'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='2'%SubPatt='3'
<%SetPattRegExp='(?is)(.*?)\((.*?)\)'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='2'%SubPatt='3'>"%-
%Subject="%SetPattRegExp='(?is)(.*?)Sender\n(.*?)\s'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='2'%SubPatt='3', Thank You!"%-
Hi %SetPattRegExp='(?is)(.*?)Sender\n(.*?)\s'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='2'%SubPatt='3'!






And that results in the following automatic email:



To: ALBERT EINSTEIN  <albert@einstein.com>
Subject: Albert, Thank You!

Body: Hi ALBERT!





I'd love to generate the message while correcting the capitalization to Albert Einstein.

I found some macros like:
CAPITALFIRST="text"
UCFIRST="text"
CAPITAL="text"

Which might be helpful, but I have no idea how to insert them into the existing macro if they are.

Would someone help me out?

Thank you!
 
Change it into:

%To=""%To="%SetPattRegExp='(?is)(.*?)Sender\n(.*?)\n'%-
%RegExpBlindMatch='%Text'%-
%Capital=_%SubPatt='2' %SubPatt='3'_ %-
<%SetPattRegExp='(?is)(.*?)\((.*?)\)'%-
%RegExpBlindMatch='%Text'%-
%SubPatt='2'%SubPatt='3'>"%-
%Subject="%SetPattRegExp='(?is)(.*?)Sender\n(.*?)\s'%-
%RegExpBlindMatch='%Text'%-
%Capital=_%SubPatt='2' %SubPatt='3'_, Thank You!"%-
Hi %SetPattRegExp='(?is)(.*?)Sender\n(.*?)\s'%-
%RegExpBlindMatch='%Text'%-
%Capital=_%SubPatt='2'%SubPatt='3'_!
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Roelof, thank you for the solution and such a quick reply! And to think that you don't even work for Ritlabs. Fantastic!

Your solution works!

But now I've run into two more issues now that I've tried moving on to the next step.

1. I added more text afterwards, and the entire email now is capitalied, not just the name.

2. If I try to add an HTML message afterward (no longer plain text), none of the macros work anymore!

I know #2 is a completely different issue, but it'd be great if I could get some help there as well.

Thank you!
 
Off hand I caný tell you what's going wrong. Though I guess you might be mismatching the number of underscores, as I used the underscore to limit the string that was to to be capitalized. (You ran out of single and double quotation marks.)
Could you post your entire template?
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
And as I don't use HTML in messages, I'm not sure to correct you're second issue.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Roelof!

I had accidentally deleted an underscore (sorry! you had gone through the effort to put it in to make it all work!) which caused the problem.

I put it back in and it works perfectly =D

(I posted the macro + html question to the forum as a new topic, so I'll see if I can get help that way)

Thanks again for all your help!
Pages: 1