Pages: 1
RSS
Help targeting the first part of a text string, target text string with random ending
 
Hi there

Hope all is well

May I ask if anyone can offer help on creating a filter that looks for part of a text string  -  I want to mark these mails as read.

The body of my email will include something like this

example 1 :

File:   /tmp/.thisfile123456

example  2 :

File:   /tmp/.thisfile7stsh5ikddl

example 3 :

File:   /tmp/.thisfilenn8585nnn

As you can see the common part is  /tmp/.thisfile


Any advice would be gratefully appreciated.

Kind regards
Brad
 
Does the string "/tmp/.thisfile" have to appear in the beginning? If not, you could probably just use a filter condition like:

"TEXT"   "MATCH"   "/tmp/.thisfile"

(without the quotes)

I guess you could also try the "STARTS WITH" operator instead of "MATCH", but maybe that will only match the beginning of the first line and not other lines.

According to the Help, you can also use regular expressions with the Match operator. I don't understand regular expressions myself, but maybe you can figure out by yourself what the expression is for "Line starts with '/tmp/.thisfile'".

btw, I just realize that '/' is a special character in regular expressions, so maybe those forward slashes in your search string will mess up the search. If so, try using '\/' instead of '/'.   (the '\' is an escape sign that will cause the '/' to be interpreted as a normal character).

Once you have found a condition that works well, the command to mark messages as 'read' is: "FLAG"  "MARK THE MESSAGE AS READ".
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Hi Daniel

Thank you for your reply and suggestions.

Maybe I am missing something here.

The folder I am trying to filter contains mail that has been filtered from the accounts inbox   -  and I was hoping to further filter some email that met the criteria I originally mentioned.


I do keep coming back to this particular folder -  and actually I cannot get any filters to work on this folder ...


I start my filter with source folder and select the folder I want to filter  - maybe that is incorrect ?  


Even removing that line and just a simple filter on the subject line does not work in that folder.

Kind regards
Brad
 
Is this a filter that you want to run manually or one that runs automatically whenever new mail comes in through your provider? If it's the latter, do any preceeding filters have the 'Continue processing with other filters' option enabled?

Does the folder contain actual messages or is it a virtual folder?

I'm not sure if I understand this part..:

Quote
I start my filter with source folder and select the folder I want to filter  - maybe that is incorrect ?  

Even removing that line and just a simple filter on the subject line does not work in that folder.

How do you specify a source folder and run the filter? What is the line that you refer to? Automatic filters are applied to Incoming, Outgoing, Read or Replied mail on a per-account basis. A manual filter can be run in just one particular folder simply by launching it there using a hotkey or through the Refilter command. But then, maybe you have found a method that I'm just not aware of :-)
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Hi Daniel

Thank you for taking the time to both consider my query and your reply


May I start by clarifying this

Quote

I'm not sure if I understand this part..:

I start my filter with source folder and select the folder I want to filter  - maybe that is incorrect ?  

Even removing that line and just a simple filter on the subject line does not work in that folder.

** Under the filter conditions there is an option to select Source folder and once selected you can actually select a sub folder of the account ( which I presume means the filter only runs on that folder)
OK  - so  

I have a POP3 account and run a number of filters on this account  moving incoming mail into different local folders .(these folders were created when setting up the filters via sorting office)


One of these folders ends up with a lot of messages all unread


I would like to manually run a filter on this folder marking the mails that match the previously listed criteria as read.


So far  -  I do not seem to be able to run any filters successfully on this folder  


Maybe this is just not possible?

Kind regards
Brad
Edited: Brad M - 14 April 2022 10:46:59
 
Quote
Brad M wrote:

[...]

I have a POP3 account and run a number of filters on this account  moving incoming mail into different local folders .(these folders were created when setting up the filters via sorting office)

One of these folders ends up with a lot of messages all unread

I would like to manually run a filter on this folder marking the mails that match the previously listed criteria as read.

So far  -  I do not seem to be able to run any filters successfully on this folder  

Maybe this is just not possible?
This is of course possible, but you probably try filter this folder using filters from "Read messages" group. I propose to put your filter to "Incoming mail" group and turn on the option "Use this filter for manual re-filtering only". I have prepared and tested such filter, and it works correctly.

Please copy and paste the following filter to your Sorting Office (into "Incoming mail" section):

Code
$$$$ TB! Message Filter $$$$
beginFilter
UID: [2FAB51F4.01D85043.4FCDA5FF.4CA08002]
Name: Select\20text
Filter: {\0D\0A\20`4`2`/2Ftmp/5C/2F/5C.thisfile\0D\0A}
Tag: ST
MarkRead
IsManual
IsActive
Ignore
endFilter
Then you will able to manually re-filter any of your folder you select. Please also note, that selecting folder with unread messages automatically select one message in this folder and after defined time delay this message becomes read.

The filter uses regular expressions syntax because of use "match" condition. So you have to use "/tmp\/\.thisfile" ex * pression (you can see it in the copied and pasted filter).
Edited: Zygmunt Wereszczyński - 26 April 2022 09:24:56
 
Hi Zygmunt

Thank you for your reply and help.

I have copied your code and tried adding in the Sorting Office as a condition

I tried

text match
message source match
text contain
message source contain

None of these worked -  al the messages in the folder are being re-filtered but the results show no images match filter.

After writing this so far -  I wonder if this is a language character issue but on changing your ' made no difference

Quote
The filter uses regular expressions syntax because of use "match" condition. So you have to use "/tmp\/\.thisfile" ex * pression (you can see it in the copied and pasted filter).

Should I be changing your code using the above?

Kind regards
Brad
 
No, the code is the filter code and you should paste it to the filter tree. Simply select "Incoming mail" section and press Ctrl-V to paste copied code.
Edited: Zygmunt Wereszczynski - 20 April 2022 16:50:39
 
My approach was:

[this forum doesn't support images - base64 code removed by Daan]

...not having the deep insight that Zygmunt appears to have.

As mentioned, note the "match" rule uses regular expressions, so you need to escape some characters (/ and .) with the backslash.

It didn't seem to work properly using "contains".  
 
Hi Zygmunt

Thank you fro your reply and explanation.

Yes I see now that the tree can be copied and pasted.

Unfortunately I cannot paste from an external source ( maybe the is a setting for this in " The Bat " )

I can copy my tree and paste into an external editor  -  I can copy a tree and paste it again but I cannot paste from the clipboard outside of The Bat.

Hi Chris

Thanks for your message as you can see your message was edited before made public so I cannot see your suggestion.

I do have that added complication that the folder I want to target actually starts with "."

Kind regards
Brad
 
Quote
Brad M wrote:
Unfortunately I cannot paste from an external source ( maybe the is a setting for this in " The Bat " )

You can paste a filter if it is in plain text.

When you go back to Zygmunt's earlier message, you can select the filter code (starting with $$$$ and ending with EndFilter) and copy it to the clipboard. Then go to a text editor such as notepad (or the plain text editor in The Bat) and paste it there. Now you have a plain text version, which you can copy to the clipboard again, and then you can paste it as a single filter in your sorting office (right-click on Incoming Mail and choose paste).
I volunteer as a moderator to help keep the forum tidy. I do not work for Ritlabs SRL.
 
Hi Daniel
Thank you for your message and advice.
Yes I am already using a text editor  -  unfortunately I still cannot paste from an external source directly into incoming mail tree.

But this was most helpful

Quote
(or the plain text editor in The Bat)

Using SmartBat -  I can paste, copy and than paste in incoming mail tree for that account!  - Creating the new filter.

Unfortunately that filter does not work for me, and on examining it in Sorting Office - it is no different from the filter I have already tried in several variations.

I do end up with going on a 1000 mails a day in this folder  so am  highly motivated in finding a way to filter these back to the ones that do need my attention.

Could it be that the file name starts with a "."  which is causing the issue?  - example here from original post ... ( /tmp/.thisfile7stsh5ikddl )

May I take this opportunity to thank everyone for the suggestions.

Kind Regards
Brad
 
I checked the filter again, copying plain text and pasting it to the "Incoming mail" section. Then I generated few messages with randomly placed text "/tmp/.thisfile". I copied these messages to a folder, then additionally put there some messages without the text being interested. Next I change all messages in my test folder to "unread", and then I sel ect test folder and use "Re-filter" option fr om the menu. I have selected the incoming mail filters to use in re-filtering.

My observation: all messages containing "/tmp/.thisfile" text become "read" and all others are intact. Conclusion: the filter operates correctly.
Edited: Zygmunt Wereszczyński - 28 April 2022 09:42:45
 
Hi Zygmunt

Thank you very much for your mail and taking the time to both test your filter and document the process and findings.

Quote
I copied these messages to a folder,

The main difference I see is that:

The folder in question contains messages that have been filtered from the accounts main inbox,  using a filter that targets the subject line, automatically moving the messages into said folder as they collected from a POP3 account.

I am going to recreate your test, just like you have described it .

I am using The Bat 9.5.1

Kind regards
Brad
 
If you want to filter messages automatically you should place this filter on the beginnng of filter list in "Incoming mail" section. Then you should switch off the option for manual re-filtering and switch on the option "Continue processing with other filters". Such configuration allows to make read the messages with text in question before moving them to target folder.

Moving filter along the list is possible by arrows located on the toolbar.
Pages: 1