[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 - Delete not needed text befor printing

Delete not needed text befor printing

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Delete not needed text befor printing

Postby ente » Sun May 04, 2008 2:33 am

Hello,

MarkB successfull working brain makes hungry... There a two more problems I was not yet able to solf myself:

Some of the mails I get contain text I would like to have it not printed because the info is superfluous and it uses only to much paper (more then 1 page).

I think it needs a specific filter and a script for wich I tried to make use of the following parts of another script of mine.

:DGP
set #ll -1
LocateLine #ll "Bestellung über ZVAB bei:" $b
if #ll > -1 then DL1
goto FL2
:DL1
DeleteLine $b #ll 11

:FL2
:set #l -1
:LocateLine #ll "Zum Bearbeiten" $b
:if #ll > -1 then DL2
:goto FL3
:DL2
:DeleteLine $b #ll 2

etc.

While the filters part works fine, the script ignores me javascript:emoticon(':oops:')
Embarassed
...because I don't know, with what the script has to start and with what to finish it.

The second problem: I would like to have a script which eliminates empty lines

After this, I promiss, I will let the moderators rest - at least form some time...
cordially, Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Mon May 05, 2008 2:05 am

Sorry, Götz, I didn't notice this new thread.

I am on the road today. Back tomorrow. In the meantime, could you please PM me the raw body of one of the emails? The raw message includes HTML codes. I think that PocoMail comes with a script called "Display Raw Message," but I'm not certain.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Mon May 05, 2008 11:25 pm

While the filters part works fine, the script ignores me javascript:emoticon('Embarassed')
Embarassed
...because I don't know, with what the script has to start and with what to finish it.

I confess that I completely misunderstood that. I got it now. You need not have posted the raw message. Sorry!

---

Anyway, do a ReadBody. Then TrimLines as a precaution. Cut individual lines of text as you have been doing, or, for brevity, cut individual lines and blocks of lines using SubStrings as illustrated below. Please note the end-of-line \n -- there are five of them. Do as many cuts as you wish. Note that one of the lines that begins with SubStrings in the sample script is very long.

You also wanted to remove blank lines. There's no good way that I can think of, but you can try this:

Code: Select all
ReadBody $b %message
TrimLines $b

{ Cut unwanted text
SubStrings $b "http://www.zvab.com\n"
SubStrings $b "ZVAB.com - ZENTRALES VERZEICHNIS ANTIQUARISCHER BÃœCHER\nHauptstrasse 2, D-82327 Tutzing\nTel.: +49-(0)8158-90788-0\nFax: +49-(0)8158-90788-10\n"

{ Remove blank lines
:CutBlankLines
StringPos #i "\n\n" $b
If #i < 1 Then EndCutBlankLines
ChopString $b #i 2
GoTo CutBlankLines
:EndCutBlankLines

MessageBox $b


Would you please put in your own SubStrings lines and test what we have so far on a few messages? (Next comes the hard part.)
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Tue May 06, 2008 1:12 am

Götz,

Let's avoid adding messages to Poco's mail folders as you wanted -- that would be problematic IMHO and too much work. Instead, let's just print the string as in the following example.

It looks like I've misunderstood again -- you didn't want to remove blank lines from THIS script; you wanted a SEPARATE script to do that on OTHER messages. If so, please elaborate on that request.

Code: Select all
{ Compress and print an email message
{ For Götz. 2008-05-06.
{ =====================================

Set $tmpmsg ""
Set $t ""

{ Get brief headers
ReadHeader $t "To:" %message
AddStrings $tmpmsg "To: " $t "\n"
ReadHeader $t "From:" %message
AddStrings $tmpmsg "From: " $t "\n"
ReadCC $t %message
If $t = "" Then EndIfCc
   AddStrings $tmpmsg "CC: " $t "\n"
:EndIfCc
ReadHeader $t "Date:" %message
AddStrings $tmpmsg "Date: " $t "\n"
ReadHeader $t "Subject:" %message
AddStrings $tmpmsg "Subject: " $t "\n"
AddStrings $tmpmsg "\n"

{ Get message body
ReadBody $b %message
TrimLines $b

{ Cut unwanted text
SubStrings $b "http://www.zvab.com\n"
SubStrings $b "ZVAB.com - ZENTRALES VERZEICHNIS ANTIQUARISCHER BÃœCHER\nHauptstrasse 2, D-82327 Tutzing\nTel.: +49-(0)8158-90788-0\nFax: +49-(0)8158-90788-10\n"

{ Remove blank lines
:CutBlankLines
StringPos #i "\n\n" $b
If #i < 1 Then EndCutBlankLines
ChopString $b #i 2
GoTo CutBlankLines
:EndCutBlankLines

{ Assemble the message and print it
AddStrings $tmpmsg $b
PrintPlainBody $tmpmsg

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

Skip unwanted text

Postby ente » Tue May 06, 2008 7:01 am

Hello MarkB,

I home again - and will be on the road tomorrow - so I won't be able to test what you have mailed me until thursday.

What I'm already now afraid of is to find out "in between what I have to place this" - the other time I called this something like "the stuff at the beginning" and "the stuff at the end".

Most of the time, when I dar change something in a script, Mr. Poco shows up telling me, that something has not been declared - and goes back to whatever.... That is why all my scripts are probably double as long as needed and take triple the time they ought to, because I make them do superfluous things for the task they are ment for. That is the best thing about Poco, apart its programmed capabilities, the scripts which are coming with it and are uncomplaining even when misstreated.

But the very best about Pocomail ist, of course, this forum with people like you or Eric, or Tomas and all the others, which help ignorants like me to show up with things the poor guys having to work with Outlook and the like don't dare to dream of.
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Fri May 09, 2008 1:52 am

What I'm already now afraid of is to find out "in between what I have to place this" - the other time I called this something like "the stuff at the beginning" and "the stuff at the end".


Just to clarify: the latest script above is intended to be complete, with beginning, middle and end. You only need to supply your own SubStrings lines.

The script was tested with PocoMail 4.5. I'm hoping and assuming that PocoScript's string commands work consistently with all character sets, and that ReadBody will consistently render new-lines as the 2-character carriage return-line feed.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron