[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - job for filter or script needed?

job for filter or script needed?

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

job for filter or script needed?

Postby ente » Sat Aug 05, 2006 8:53 am

some of the companies I'm working with stopped sending bills by ordinary mail but send them by email and are expecting that I print them out myself.

At the same time they are also sending lots of infos I don't care about. Up to now I brought these mails by use of a filter into the folder abebboks_info and missed the bills until a got a reclamation.

Now I would like to have pocomail to print out the attachment with the name bill.pdf and then move the mail to abebooks_info.
Or, if that is to much, at least have pocomail blowing a wistle if the attachment has this name, or has an attachment before moving it, like all the others into abebooks_info.

I tried all kind of filters - without success and also the hunting in the existing script library was without success. can anybody help.

tnx, ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sun Aug 06, 2006 8:29 am

Here is an idea for the whistle-blowing filter:

Search From for [address]
And
Search X-Poco-Attachment for bill.pdf
then
Perform dialog box with text
Another confounded bill from the phone company

If your PDF reader accepts command line parameters, you could perhaps have the filter call a PocoScript that retrieves the full path and name of the attached file and runs (Execute) the PDF reader, giving the name and the print command in the command line.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Mon Aug 07, 2006 9:51 am

MarkB wrote:Here is an idea for the whistle-blowing filter:

Search From for [address]
And
Search X-Poco-Attachment for bill.pdf
then
Perform dialog box with text
Another confounded bill from the phone company

If your PDF reader accepts command line parameters, you could perhaps have the filter call a PocoScript that retrieves the full path and name of the attached file and runs (Execute) the PDF reader, giving the name and the print command in the command line.


Hello MarkB,
that sounds very nice. Only, I find no way to enter the command

Search X-Poco-Attachment

So I can't find out if my PDF reader accepts command line parameters. Actually I think he will (he is an Adobe Acrobat).

ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Mon Aug 07, 2006 10:06 am

ente wrote:Hello MarkB,
that sounds very nice. Only, I find no way to enter the command

Search X-Poco-Attachment

Type in the text X-Poco-Attachment in the combo box beside "Search."

I don't have Acrobat Reader, unfortunately.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Wed Aug 09, 2006 4:27 am

How are you getting along with this?

The filter described is tested (PocoMail 3.4) and appears to work as you wish on both incoming and received mail. The assumption is, however, that Poco is decoding attachments and saving them, probably in the Attach folder. If you are not decoding attachments, if you have checked "When receiving attachments, leave attachments encoded inside the message" under Encoding Options, then the header X-Poco-Attachment evidently will not be present and you will have to look for something else.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Wed Aug 09, 2006 8:17 am

MarkB wrote:How are you getting along with this?

The filter described is tested (PocoMail 3.4) and appears to work as you wish on both incoming and received mail. The assumption is, however, that Poco is decoding attachments and saving them, probably in the Attach folder. If you are not decoding attachments, if you have checked "When receiving attachments, leave attachments encoded inside the message" under Encoding Options, then the header X-Poco-Attachment evidently will not be present and you will have to look for something else.


Hello

after slapping myself (almost) for not simply typing X-Poco-Attachment in the box but trying all kind of manoeuvers with the expressions given in the scroll box, I started the construction of the filter as you proposed. I have not yet finished because I don't know yet how the script file has to look. I will go on with that this weeekend.
If you say this filter is tested - what type of PDF program do you use? If you have this script already written, may be you could place it here in the forum. I'm sure about that this is a function which might be usefull for many others.

Of course I will set Poco to decode and save attachments.

Thank you once more, ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Wed Aug 09, 2006 10:12 am

My PDF reader is Foxit Reader (small, quick loading). Foxit in recent versions has removed print from its command line options for some reason.

The PocoScript command Execute will launch documents as well as programs if the document type is registered. For example, probably if you double-click a PDF file name, Acrobat will open with that file loaded. If so, the following little PocoScript should open the document, I think (very limited testing). Copy it to Notepad, and save it to PocoMail's Scripts folder with a file name ending with .poc. When the doc opens, you'll have to hit Ctrl-P yourself. :-) Or modify the Execute line.
Code: Select all
{ Print Ente's Bill
ReadAttached $attachmentlist %message
TrimLines $attachmentlist
LocateLine #n "bill.pdf" $attachmentlist
GetLine $a #n $attachmentlist
If #n < 0 Then Done
Execute $a
:Done
Exit
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby Michael » Fri Aug 11, 2006 1:18 am

One small gocha with this method, when you decode attachments Poco will put them all in the Attach directory. If you get multiple files with the same file name Poco will rename them adding a numeric suffix to the end of the file name. The script will need to be modified to check for this.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby MarkB » Fri Aug 11, 2006 7:12 am

Hi, Michael.

We covered that issue in PMs. And the two reversed lines in the script. The proposed answer was to search for ".pdf" and "bill".

--Mark
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Fri Aug 11, 2006 7:25 am

Also...

"One small gocha with this method...": With this method? If you want to chime in with another filter method, please do. I can't get the filter to fail; Ente can't get it to work. (Not talking about a script here.)
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby Michael » Fri Aug 11, 2006 3:56 pm

Hi Mark,

The gottcha I was referring to was the fact that the script would not work for every message due to the automatic renaming of the attachments. You've already dealt with that via PM's so the script issue has been addressed. I presume the same was done for the filter (two separate searches of the X-Poco-Attachment header).
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

script or filter

Postby ente » Fri Aug 11, 2006 8:53 pm

Hello Mark & Michael,
I feel flattered, now also the boss jumps in...
I answer only today because last time, suddently the shop was full of clients (I deal with old books)

So I did an extra and deleted all of the old filter and started from scratch.
The new filter for the time being looks like this

Search From for zvab.com
matching ignore non-text / all characters
and
Search x-Poco-Attachment for mahnung.pdf
Perform dialog box with text
Neue Rechnung von ZVAB

Here all this out of the filter.ini:
mahnung@zvab.com,From,dialog,"Neue Rechnung von ZVAB",0,0,,and,0,mahnung.pdf,X-Poco-Attachment,move,In,0,0,,0,,,move,In,0,0,,0,,,move,In,0,0,,0,,,move,In,0,0,,0,,,move,In,0,0,1,1

Concerning matching: that means that I have tried both

As the old filter, also the new one doesn't make Poco to show any reaction

BTW: I use 4.1, build 3650 and I'm a long time registered user!
BTW: what "gottcha" stands for?

And: The PDF has been decoded, it resides in P:\ABC\pocomail\attach
and is the only file with that name
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sat Aug 12, 2006 5:46 am

I'm struggling to get online time here, owing to an interminable series of thunderstorms overhead and 100% condensing humidity.

My suggestion, Ente, is to roll up your sleeves and do some old-fashioned troubleshooting. First, examine the full headers of your test message and verify that zvab.com is present in the From line and mahnung.pdf in an X-Poco-Attachment line.

Second, which search in your filter is failing? Delete the filter. Close and re-open Poco. Create a filter with one simple search (of From) and one simple action (dialog with text). Test. Add another single element. Test. And so on.

Gotcha: an unexpected usually disconcerting challenge, revelation, or catch -- http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=gotcha

--Mark
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sat Aug 12, 2006 5:48 am

Michael wrote:Hi Mark,

The gottcha I was referring to was the fact that the script would not work for every message due to the automatic renaming of the attachments. You've already dealt with that via PM's so the script issue has been addressed. I presume the same was done for the filter (two separate searches of the X-Poco-Attachment header).

Michael, sorry, I was referring to the filter. We're far, far away from scripting at this stage.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby Michael » Sat Aug 12, 2006 6:08 am

MarkB wrote:My suggestion, Ente, is to roll up your sleeves and do some old-fashioned troubleshooting. First, examine the full headers of your test message and verify that zvab.com is present in the From line and mahnung.pdf in an X-Poco-Attachment line.

--Mark


One simple way to do this testing that Mark is suggesting is to copy the filter to one of the manual tabs. To do this open the filters window, select the filter you want to copy, right click and select "Copy to..." and then choose one of the manual filter options. Next go to the manual tab and change the filter action to "Dialog box with text", enter a text phrase and then run the filter manually against a message that matches the criteria.

Experiment by removing the 2nd set of the criteria and see if the filter matches, if it does then try changing the filter to only use the first.

Mark's suggestion for checking the headers is also correct, you need to examine them to be sure there is an "X-Poco-Attachment" header and that header contains the name of the file you are looking for.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Next

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron