[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 - Move to folder

Move to folder

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Move to folder

Postby ente » Wed Apr 06, 2011 3:40 am

Hello MarkB,
I was a nice boy a did not disturb you for a long time... But now I have a problem I was not able to fix myself.
With the following script I confirm to a client that my bank has confirmed his payment an that the book he has ordered will be mailed the next day. This process is initialized by clicking on a specific mail and then going to the menu "any script run on selected". This confirmation mail is moved to the "confirmation directory" (=Korrespondenz\Debitoren\Alle_Rechnungen\Zahlungsvollzugbestätigung). What I was not able to achieve is that the mail I used to initialize this process is moved to the folder Korrespondenz\Debitoren\Rechnungen\Voroausbezahlt
Can you tell me how to procede?
Thank you
ente


External $userdata1 "Choose a character to quote message with:" ">"
{### Reply to Mail from ABC with Template
{----------
{v1.0 - 2002.02.11 - Roger Leemann / Götz Perll
{ Copy of "Reply with Template"
{----------
{ This script will reply to a message from a saved template
{ Usage: not suitable for automatic use; use only on demand.

{ Initialize user settings: }
External $userdata1 "Choose a character to quote message with:" ">"
External $userfile1 "Create body template" "Zahlungs_Eingang.txt"

CreateMessage %m
ReadHeader $a Subject %message
AddStrings $subject "Zahlung eingegangen für: "
AddStrings $subject $a
SetHeader %m Subject $subject

{ OpenBody $Body $userfile1
{ ReadHeader $From From %message
{ AddTo %m $From

OpenBody $Body $userfile1
ReadHeader $To To %message
AddTo %m $To

{ If template file exists load it }
FileExists &F $userfile1
if &F then UseBody

{ Otherwise, use a blank template }
Set $a "MESSAGE BODY TEMPLATE CURRENTLY NOT SET"
AppendBody $a " "
AppendBody $a " "
AppendBody $a "To use this script, please setup a default message body template:"
AppendBody $a " "
AppendBody $a " press F9 to open Filters and Scripts window, then click on Setup Script."
AppendBody $a " From the drop down box select script \"Reply with Template\"."
AppendBody $a " Click on the Create Body Template button to create a template."
AppendBody $a " When done, just click on File, Save."
goto Edit

:UseBody
set $a $Body

:Edit
ReadBody $b %message

{v1.0 delete certain lines with information that the adresseee shouldn't see

set #ll -1
LocateLine #ll "Sehr geehrte" $b
if #ll > -1 then DL1
goto CONT
:DL1
DeleteLine $b #ll 45

:CONT
QuoteBody $b $UserData1
AppendBody $a " "
AppendBody $a $b
AssignBody %m $a
AppendSignature %m
EditMessage %m
{SaveMessage %m "Korrespondenz\Debitoren\Alle_Rechnungen\Zahlungsvollzugbestätigung.mbx"
MarkMessage %message 7
{DeleteMessage %message
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Re: Move to folder

Postby MarkB » Wed Apr 06, 2011 5:17 am

Hello, Götz.

To move the selected message and mark it, try this, near the bottom of your script:
Code: Select all
DeleteMessage %message
MarkMessage %message 7
SaveMessage %message "Korrespondenz\Debitoren\Rechnungen\Voroausbezahlt.mbx"
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Move to folder

Postby MarkB » Wed Apr 06, 2011 7:24 am

Did you also want the confirmation message moved automatically? I would probably do that with a Post-Send filter:
Search Subject for Zahlung eingegangen für:
If found then Perform move message to Zahlungsvollzugbestätigung
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Move to folder

Postby ente » Thu Apr 07, 2011 1:03 am

MarkB wrote:Did you also want the confirmation message moved automatically? I would probably do that with a Post-Send filter:
Search Subject for Zahlung eingegangen für:
If found then Perform move message to Zahlungsvollzugbestätigung


Hello Mark,
thank you for that speedy solution. I deleted the last lines of my old script, the five last lines look now like this:

Code: Select all
AppendSignature %m
EditMessage %m
DeleteMessage %message
MarkMessage %message 7
SaveMessage %message "Korrespondenz\Debitoren\Rechnungen\VorausBezahlt.mbx


Furthermore I make use of a post send filter, as you have suggested. What is somehow irretating (but absolutly logical) is, that the mail gets mved not when the replay is mailed, but when I run the script, that is even before the answer is wirtten.
Many thanks again,
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Re: Move to folder

Postby MarkB » Thu Apr 07, 2011 1:43 am

AppendSignature %m
EditMessage %m
DeleteMessage %message
MarkMessage %message 7
SaveMessage %message "Korrespondenz\Debitoren\Rechnungen\VorausBezahlt.mbx

Don't forget the closing quotation mark (after .mbx).

We are dealing with two distinct messages here.
1. The source message. This is the message that you select before you run the script. The source message should remain intact and unchanged. The script moves this message, at run time, to the folder that you specify in the script.
2. The confirmation message. This is the message that you edit and send. The confirmation message gets moved after it has been sent and should be an exact facsimile of the sent message.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Move to folder

Postby ente » Thu Apr 07, 2011 3:45 am

Don't forget the closing quotation mark (after .mbx)


...I had forgotten about. And it worked anyway (?!) How, resp. why is that possible?
Kind regards,
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland

Re: Move to folder

Postby MarkB » Thu Apr 07, 2011 10:07 pm

It's a quirk. The following little script produces 3 message boxes and 1 error message. (But use quotation marks in pairs anyway.)
Code: Select all
MessageBox Hello
MessageBox "Hello World"
MessageBox "Hello World
{ Error...
MessageBox Hello World
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Re: Move to folder

Postby ente » Fri Apr 08, 2011 9:45 am

But use quotation marks in pairs anyway

aye aye Sir
Götz
ente
Resident Poster
 
Posts: 182
Joined: Mon Sep 27, 2004 7:17 am
Location: Zurich, Switzerland


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron