I have a filter that changes the designation mailbox of a message from "In" to "Junk Mail" if it is determined to be spam.

Pretty straight forward. Search for a condition, if found move (or place) message in "Junk Mail". As a second operation for that filter I would like to be able to run a script that can determine where the message was placed rather than where it should have gone. $CurrentMailbox tells me where it should have gone, not where it went.

Is there a way for the next script to know where the message actually went?

I sent the same question to tech support to see what they would suggest. Slaven replied that there isn't really a way to determine the mailbox a message is placed into. What he suggested was my fall back, create a version of the script for each mailbox the message may be placed into. Complicates script maintenance a bit, but workable.

One of the things I do with scripts all the time is to place my own headers into incoming msgs. So I create something like "X-sgm-WhichMailbox:" where sgm is my initials and the rest is whatever I like. One can also add data to the header such as "X-sgm-WhichMailbox:=JunkMail" at any time.

Pocoscript doesn't really have a way to pass parameters from one script to another, so I use this method. That way I can query the msg in a subsequent script for what a previous script may have done.

This may not help you since once you send a msg to a mailbox no subsequent scripts will run. (Actually, I get around this limitation too by having a final script -- I call "sgmFinal" -- and ONLY it is allowed to make the final disposition of the msg; it does so by querying these headers I place into the msg in any previous scripts.)

I simplified the question for the post. There are actually six mailboxes involved. The workarounds will require six versions of the script. It is easy to create the original copies of the script modifying the name slightly each time. The difficulty is in keeping track of which script goes with which filter, and worse yet, doing symetrical updates when all six of the scripts are revised.

As an alternative to your technique, you can save information to a temporary file, retrieving and deleting the file (if necesary) in subsequent scripts.

As an alternative to your technique, you can save information to a temporary file, retrieving and deleting the file (if necesary) in subsequent scripts.

Yes, but I like to have a record of the decisions the scripts made documented right in the msg. Since that info is stored in the headers, it is never lost, AND it's never in my way since I rarely process msgs with "View All Headers" enabled.

In any case, by using either the "headers" method, or the "temp file" method, you could reduce your situation down to one script and avoid the maintainance problem you speak of. Certainly what I would do.....but to each his own.

In each case the decision as to where the message will be stored is determined in the filter. What I then need is a script that will take an action based on where the message was stored.

Adding information to the message header would work, but I think you will find you will still need a separate script for each case since the script has no way of determining where the message will ultimately end up, except by knowing which filter has called the script. Since there is not a way to determine which filter called the script, the solution is that each filter must call a unique script.

Both methods require a separate script for each filter. Using your final script method will only move the unique script requirement earlier in the process.

Altho I do use filters for a few things, if there is any significant processing to be done I don't invoke the script via a tradition filter, but rather use the "Add Script" option on the Incoming Filters screen (Tools|Filters). Such a script is invoked for ALL incoming msgs. Then I use Poco commands in the script (e.g., ReadTo, or ReadHeader) to determine what type of msg it is, and what sort of action to take (the equilvalent of your "Filter 1: Search <location> For <matching text1> Perform <store in mailbox1>" except I can do the equilvalent of all 4 of your example filters in a single script).

Other times I allow a traditional filter to send the incoming msg to a script (as you are doing now) and then use my "add a header" technique to pass info to some subsequent script that will run via the "Add Script" facility.

I will be adding some further information after these. That is what one of the two additional scripts are for.

Every e-mail case is covered so that the total of the destinations will equal the number of incoming messages, with two exceptions:

1) "Would Have Been Spam Address" will show how many would have been caught by the Spam Address filter if they hadn't been caught by something else first. How many were caught first will be the diffference between "Spam Address" and "Would Have Been Spam Address".

2) E-mails with file extensions I have banned, .src and .com, are deleted before they reach any other filters so they are not counted [yet]. In order to count these I will have to modify the Attachment Remover script.

{ IncSpamEntire - Version 1.00{ Author: Scott Taylor - February 14, 2006{{ Purpose: This script updates a counter to indicate how many incoming messages have been caught{ by the SpamEntire keyword filter.{{ Method: The script opens the text file where the statistics are stored, increments the count{ for SpamEntire hits and saves the file.{{ Open the statistics fileSet $FileName "..\Stats.txt" { use Pocomail main directoryOpenBody $Stats $FileName { get existing file contents

Set #line 4 { predefined locationsGetLine $line #line $Stats { get text on that line, put in $lineStringPos #pos " " $line { the numerical portion is before the spaceSet $num $line { make a working copyChopString $num #pos 999 { delete all but the numberDec #pos { reduce by oneChopString $line 1 #pos { delete number portion of the string, leaving the space

Set #num $num { move to numerical variableInc #num { add 1Set $num #num { move back to string variableAddStrings $num $line { put the number back in front of the text descriptorSet $line $num { put result back in $line

I will be adding some further information after these. That is what one of the two additional scripts are for.

Every e-mail case is covered so that the total of the destinations will equal the number of incoming messages, with two exceptions:

1) "Would Have Been Spam Address" will show how many would have been caught by the Spam Address filter if they hadn't been caught by something else first. How many were caught first will be the diffference between "Spam Address" and "Would Have Been Spam Address".

2) E-mails with file extensions I have banned, .src and .com, are deleted before they reach any other filters so they are not counted [yet]. In order to count these I will have to modify the Attachment Remover script.

{ IncSpamEntire - Version 1.00{ Author: Scott Taylor - February 14, 2006{{ Purpose: This script updates a counter to indicate how many incoming messages have been caught{ by the SpamEntire keyword filter.{{ Method: The script opens the text file where the statistics are stored, increments the count{ for SpamEntire hits and saves the file.{{ Open the statistics fileSet $FileName "..\Stats.txt" { use Pocomail main directoryOpenBody $Stats $FileName { get existing file contents

Set #line 4 { predefined locationsGetLine $line #line $Stats { get text on that line, put in $lineStringPos #pos " " $line { the numerical portion is before the spaceSet $num $line { make a working copyChopString $num #pos 999 { delete all but the numberDec #pos { reduce by oneChopString $line 1 #pos { delete number portion of the string, leaving the space

Set #num $num { move to numerical variableInc #num { add 1Set $num #num { move back to string variableAddStrings $num $line { put the number back in front of the text descriptorSet $line $num { put result back in $line