[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 - Print specific to Sender

Print specific to Sender

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Print specific to Sender

Postby ente » Mon Apr 26, 2010 7:04 pm

To faccilitate the administration of mails containing an order, I would like to add to the printout of such a mail in the text body four additional lines:
In Stock:
Confirmed:
CC charged:
Posted:
There could then be noted manualy on the paper the date on which the specific operation was made. I went through the script library looking for a script giving me an idea how such a thing would have to be done - unfortunately in vain.
Up to now I have an filter which places the mail in a specific folder when it comes from a specific sender and contains in the subject a specific information.
I wish all of you have as good spring weather as we have today in Zurich
Ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Tue Apr 27, 2010 12:16 am

This script fragment can be used for your printing routine. It should work with either incoming or selected messages. It should be fine for both plain text and simple HTML messages. Re-arrange the lines in $msg if you wish. Please let us know if this is not what you need.

Code: Select all
Embed $msg "EndEmbed"
From: %sender% <%from%>
Subject: %header%:"Subject"
Date: %sent%
To: %to%
CC: %cc%
%body%
%attachments%
--- FOR OFFICE USE ---
In Stock:
Confirmed:
CC charged:
Posted:
EndEmbed
ReplaceCVT $msg %message False
PrintPlainBody $msg
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Tue Apr 27, 2010 11:10 pm

MarkB wrote:This script fragment can be used for your printing routine. It should work with either incoming or selected messages. It should be fine for both plain text and simple HTML messages. Re-arrange the lines in $msg if you wish. Please let us know if this is not what you need.
[/code]


Good day MarkB
It is precisly what I was looking for, thank you very much. I only had to arrange some of the lines - to have them on the top of the page - (and to translatethem it into german). Below you see how it looks now.
There is only one thing: I have a print template which uses a small size Tahoma font (to economize paper). This template is now ignored. What must I do to make this script using the small size font.
Thank you, ente
..............................................................

Embed $msg "EndEmbed"
From: %sender% <%from%>
Subject: %header%:"Subject"
Date: %sent%
To: %to%
CC: %cc%

--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
%body%
%attachments%
EndEmbed
ReplaceCVT $msg %message False
PrintPlainBody $msg
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Wed Apr 28, 2010 1:42 am

Here's a problem. Poco's print template won't retain settings for me (Poco 4.8, Win7 Home Premium). All I get is Tahoma Medium. So I am not able to test.

We could try a script that uses PrintMessage instead of PrintPlainBody. Poco Help states that PrintMessage obeys the template settings.

Code: Select all
CreateMessage %m
ReadHeader $t "From:" %message
AddHeader %m "From:" $t
ReadHeader $t "Subject:" %message
AddHeader %m "Subject:" $t
ReadHeader $t "Date:" %message
AddHeader %m "Date:" $t
ReadTo $t %message
AddTo %m $t
Embed $body "EndEmbed"
--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
EndEmbed
ReadBody $t %message
AppendBody $body $t
AssignBody %m $body
PrintMessage %m


If that doesn't work, we'll be forced to get serious. ;)
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Wed Apr 28, 2010 3:40 am

MarkB wrote:Here's a problem. Poco's print template won't retain settings for me (Poco 4.8, Win7 Home Premium). All I get is Tahoma Medium. So I am not able to test.

If that doesn't work, we'll be forced to get serious. ;)


Hello MarkB,

no need to use force! No need to get serious! - It works!

Me to, that means my Poco 4.8, Win XP professionals to, does not retain small font - when I look at the print template... But when I print, it uses a font which looks like being small.

Thank you very much, this will be a great help at daily work!
Ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby ente » Sat May 01, 2010 3:00 am

ente wrote:Thank you very much, this will be a great help at daily work!
Ente


Hello MarkB,
this "script fragment", as you called it humble, has meanwhile been adapted for three more administrative jobs which have to be done with a paperform, and everybody (well, there are just the three of us...) is very happy about this 'genious progress' (said Carmen) we have done by this.

But... there is tiny itch:
AddHeader %m "Date:" reads not the date the mail was send, but the actual date the mail gets manipulated (in my case printed).

In my print template the command looks like this

Datum: %sent% (=Date) gives ...the date the mail was send
An: %to% (=To:)
Gedruckt: %date%, %time% (=printed) ...the date the mail gets manipulated

I tried to find out with help of the script manual, how this command would have to look - without success
Can you tell me.
Thank you, ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Sat May 01, 2010 5:11 am

ReadHeader $t "Date:" %message reads the sent date. That's not the problem.

This is the problem: The second script above creates temporary, disposable messages for printing. This method is easy, it works with incoming mail as well as stored mail, and it preserves the integrity of (i.e., doesn't modify) stored messages. I now see that Poco supplies a Date header automatically when creating a message. The disposable messages we've been creating so far actually have 2 Date headers: one added by the script, and another, preceding that one, added by Poco. Bummer. (That second Date header can be deleted, but I don't want to do that.)

Will you be running this script only manually on selected messages (as opposed to activating it by a filter on incoming mail)? If so, try this version. Note that it modifies the stored message.

Code: Select all
If #PocoScriptMode = 5 Then DoIt
AddStrings $t "The script '" $PocoScriptName "' is for selected messages only"
MessageBox $t
Exit
:DoIt
Embed $t "EndEmbed"
--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
EndEmbed
Set $body $t
ReadBody $t %message
AppendBody $body $t
ClearBody %message
AssignBody %message $body
SaveMessage %message $CurrentMailbox
DeleteMessage %message
PrintMessage %message


Edit: changed the error message.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sat May 01, 2010 5:45 am

Also, ente, I really enjoy your cheerful posts.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sat May 01, 2010 7:00 am

Another option is to modify the second script so as to add a "Sent" line. It will appear below the horizontal line that Poco prints.

Code: Select all
CreateMessage %m
ReadHeader $t "From:" %message
AddHeader %m "From:" $t
ReadHeader $t "Subject:" %message
AddHeader %m "Subject:" $t
ReadTo $t %message
AddTo %m $t
ReadCC $t %message
AddCC %m $t
ReadHeader $t "Date:" %message
AddStrings $line "Sent: " $t "\n"
Set $body $line
Embed $t "EndEmbed"
--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
EndEmbed
AppendBody $body $t
ReadBody $t %message
AppendBody $body $t
AssignBody %m $body
PrintMessage %m
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Sat May 01, 2010 10:53 am

I'm sorry to make so many posts. Earlier I objected to deleting the Date header that Poco adds in the "second method" because doing so seemed more like hacking than script writing, but I've reconsidered. The following is a modification of the second script that gives the "sent" date (not the current date) in the printout and doesn't add any lines to the printout. Thank you for your patience.

CC header data is now included in case your print template makes room for it. This way the CC line won't end up misleadingly blank in the printout.

Code: Select all
CreateMessage %m
ReadHeader $t "From:" %message
AddHeader %m "From:" $t
ReadHeader $t "Subject:" %message
AddHeader %m "Subject:" $t
ReadTo $t %message
AddTo %m $t
ReadCC $t %message
AddCC %m $t
DeleteHeader "Date:" %m
ReadHeader $t "Date:" %message
AddHeader %m "Date:" $t
Embed $t "EndEmbed"
--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
EndEmbed
Set $body $t
ReadBody $t %message
AppendBody $body $t
AssignBody %m $body
PrintMessage %m
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby ente » Mon May 17, 2010 6:41 am

MarkB wrote:I'm sorry to make so many posts. Earlier I objected to deleting the Date header that Poco adds in the "second method" because doing so seemed more like hacking than script writing, but I've reconsidered. The following is a modification of the second script that gives the "sent" date (not the current date) in the printout and doesn't add any lines to the printout. Thank you for your patience.

CC header data is now included in case your print template makes room for it. This way the CC line won't end up misleadingly blank in the printout.

Code: Select all
CreateMessage %m
ReadHeader $t "From:" %message
AddHeader %m "From:" $t
ReadHeader $t "Subject:" %message
AddHeader %m "Subject:" $t
ReadTo $t %message
AddTo %m $t
ReadCC $t %message
AddCC %m $t
DeleteHeader "Date:" %m
ReadHeader $t "Date:" %message
AddHeader %m "Date:" $t
Embed $t "EndEmbed"
--- BESTELLUNGSVERWALTUNG ---

geholt und ausgetragen:
----------------------------------------------------
Bestätigungs-Mail versandt:
----------------------------------------------------
Master / Visa Code bestellt:
----------------------------------------------------
Versandt:
------------------------------------------------------------------------------
EndEmbed
Set $body $t
ReadBody $t %message
AppendBody $body $t
AssignBody %m $body
PrintMessage %m


Hello MarkB,
sorry for letting you waiting for an answer. First I was away, then I had to cope with the work not done when I was away, then my computer crashed, then I had to get a new one - which has now Windows 7... What looks - at least up to now - to cause more problems then it solves (For the time being, I regret to have moved to window 7 since xp professional works very safe and does not look so trendy & stylish w7.
And many things seeme not to work - that is also so for Pocomail, like:
> There is no more information sent when I get an answer (e.g. from you) for a contribution of mine in the Pocomail forum
> the automated filter editing when a folder name gets changed does not reflect the changes
> In the email header I cannot write into the subject field
> and, most bizarre: till about 4 hours ago in the index the date field looked like 5/17/22010/16/51 PM and and mm and dd got often mixed up and then suddently and without any intervention of mine, went back to the standard 17.05.2010 16:51

Because of this and many more problems with other programs I was not yet able to look at the script above, and also not the one yoiu send before. I still use the first one which keeps the mails unchanged.
As soon as work works normal again, I'll check out about the script above
sincerely, ente
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Postby MarkB » Mon May 17, 2010 7:31 am

It's good to hear from you, ente. Yes, migrating to a new computer and a new operating system can be traumatic. I predict, though, that you will eventually grow to like Windows 7.

In the email header I cannot write into the subject field

The insertion point, or cursor, is not visible while the Subject box is empty, but you can type in the Subject box nonetheless.
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 1 guest

cron