Pages: 1
RSS
Complex reply macro, Complex reply macro
 
Hi, I have a headache :) for creating a quite complex reply macro in TB. Can anyone help?

I created a drawing of my problem:
http://i35.tinypic.com/or55qu.jpg

Supplement:
1. It can be two/three/etc. surnames.
2. It can be EUR and USD only.

Thanks for help.
Edited: Rueler - 16 October 2008 23:55:52
 
Try something like this:

%SetPattRegExp='(?is)Reference ID: 000000000000 - Access for (.*?) days'%-
%RegExpBlindMatch='%OSubject'%-
%_Days="%SubPatt='1'"%-
%-
%SetPattRegExp='(?is)This email confirms that you have received a donation of (.*?) from (.*?) \((.*?)\)'%-
%RegExpBlindMatch='%Text'%-
%_Amount="%SubPatt='1'"%-
%_Name="%SubPatt='2'"%-
%_Address="%SubPatt='3'"%-
%-
%Subject="Thanks for your donation. You can access our website for %_Days days."%-
%-
%To=""%To="%_Address"%-
%-
You (%_Name) have donated %_Amount, so you are able to access our website for %_days days.
blablabla


I didn't test it, there's no fun in that.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Roelof, thank you for your exhaustive explanation. It works perfectly! but there is one problem related to this: What do I need to do if I get another than yours example email?

For instance (this works good):
"SUBJECT": Reference ID: 00000000000 - Access for %_days days

but if I get, for instance, this email:
"SUBJECT": Information question (or anything else)

Then whole your macro script fails. So, if its possible to specify a condition for SUBJECT line? Let's say, if I get email containing this in SUBJECT: "Reference ID: 00000000000 - Access for %_days days", it switches to your macro, but if I get this: Special offer (or anything else), then macro switches to a second condition (default TB! reply). I think this can be done with IF function. But how?

Thanks.
Edited: Rueler - 17 October 2008 19:56:27
 
Don't make it too difficult.
Create a filter that checks whether the sender is your website and the subject contains 'Reference ID: 000000000000' and let that trigger the autoreply we discussed.
Now for your information request you set another filter: one that checks for the sender and for 'information request' in the subject header. Create a new reply template for this second filter.

Don't try to create one template that checks for every possibility, though it's possible to do so, your template would get way too complicated for easy maintenance.

In order to keep your sorting office structured you could create a filter that checks whether the sender is your website and moves the message to a folder. (This is the parentfilter)
Next you create a subfilter that checks for the reference ID subject and have that create an autoreply and move the original message to a subfolder (you can use multiple actions in one filter)
Finally you create another subfilter that checks for the information request subject and have that filter create its own autoreply and move the message to its own subfolder.
As a final touch you could set both subfilters to mark their messages as read.
This will sort all messages sent by your website to a folder with two subfolders, the donations and the information requests are sorted in their own subfolder and as they've been handled they're marked as read. Other messages sent by your website are stored in the first folder, but aren't marked as read and therefore you know that you'll have to deal with those yourself.
Furthermore, when there will be another type of message that will need an automatic reply, you simply create another subfilter and matching subfolder and the system will be kept going.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
Wow, I was amazed what can I do with TB! Especially with Filters :). But reg exp macro is one of the hardest thing to understand for me :(. So, I've tried to modify a little your macro for extended capabilities, unfortunately, with no luck. So can you help me again?

---------------------------------------------------------------------------------------------------------------------------------
First deal:
Need to force capitalize first letter of donors name and surname (also may be middle name/etc.) For example, I can get this:

...that you have received a donation of (.*?) from johhny van john...

need to transform to this:
...that you have received a donation of (.*?) from Johhny Van John...

If macro finds correct case, it leaves it untouched.
---------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------
Second deal:
How can I leave first name only, deleting middle name/ surname/etc.?

This is that I can get (text in italics are comments):
Message from Johhny Van John:
(or)
Message from Johhny John:
(or)
Message from Johhny:
(or)
Message from Johhny Zillion Van John:

Need to change to this:
Hi, Johhny,

blablabla
---------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------------------------------------
Third deal:
I created a subfilters followed by your instructions which makes a messages to be autoreplied. Is it possible to delete autoreplied messages from "SENT MAIL" AUTOMATICALLY?
---------------------------------------------------------------------------------------------------------------------------------

Thanks in advance. ;)  
Edited: Rueler - 23 October 2008 15:45:11
 
The third point is easy. As you defined your autoreplies yourself, you simply set an outgoing filter to delete the messages with subject header that you set for your aurtoreplies and let them delete the message.
As oputgoing filters are processed after the message has been sent, you won't have a cluttered Sent Mail folder.

Items one and two take a little bit more time and I haven't got that at the moment.
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
 
OK. Now I'm modifying myself this macro. Can you tell me what does "(?is)" means?

In your macro:
%SetPattRegExp='(?is)Reference ID: 000000000000 - Access for (.*?) days'%-

Beginning of line? What if I'll delete it? Can you explain?

Thanks.
 
Check the help file:
Advanced use -> Regular expressions
That contains the info you need

BTW In order to change the first character of a string into upper case, you can use the %CapitalFirst="text" macro.  
__________________________________
I'm just a user of The Bat! I don't work for Ritlabs.
Pages: 1