[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 - Script for moving mail

Script for moving mail

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Script for moving mail

Postby mig62 » Tue Sep 28, 2004 5:32 am

I have the "toggle read/unread script" that I use to mark messages. I also have a read/unread mailboxes. Is there a script or can anyone help me create one that would automatically move the message from the unread to the read mailbox when I toggle the message? I know little or nothing about scripting and just use what I can find in the extras. Thank you for any help.
mig62
 

Postby Michael » Tue Sep 28, 2004 3:30 pm

I tried to modify this script to do what you wanted but unfortunately the message does not get deleted from the source (original) mailbox. I'm not sure if this is a bug or not. If anyone wants to test this to confirm it please send me a private message with your email address and I'll send you a copy of the revised script.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby Michael » Wed Sep 29, 2004 2:21 am

Thanks to Pete for finding what appears to be a bug in the PocoScript interpretter (leading blanks can cause commands to not be recognized). I'll add this to Bug Traction.

In the meantime here's the script with lines left aligned:
Code: Select all
{============================================================================
{ Toggle Read/UnRead Script - Date: August 27th 2003 - Author: Ron Bos (NL) 
{
{ This script toggles the "read"/"unread" status of marked messages by
{ changing the "X-Poco-Status" header in PocoMail V3, or the  "Status"
{ header in PocoMail V2.
{
{ The script should be assigned to a Script Button on the Toolbar.
{
{ The contents of the "(X-Poco-)Status" header can be:

{    xB - Bounced
{    xF - Forwarded
{    xP - Pending (Draft messages)
{    xQ - Queued
{    xS - Sent
{    xW - Replied
{
{    x can be either R or U (Read/Unread)
{
{ Modifications:
{ 28Sep2004 - M.Motek - Add option to automatically move messages to read/unread mailboxes.
{==========================================================================

External $AutoMove "Automatically move messages? (Yes or No)" "No"
External $ReadMailbox "Read mailbox%mailboxes%" ""
External $UnreadMailbox "Unread mailbox%mailboxes%" ""

LowerCase $AutoMove
{
{ Determine the PocoMail version.
{
Char $Version 1 $PocoVersion

If $Version = 3 Then Version-3
   
If $Version = 2 Then Version-2

{ If not 2 or 3, Just Exit
Exit

:Version-3
Set $Status-Header "X-Poco-Status:"
GoTo Check-Status
   
:Version-2
Set $Status-Header "Status:"

{
{ Get the "Status-Header" and save it in $Status
{
:Check-Status 

ReadHeader $Status $Status-Header %message

{
{ Save the "Read/Unread" flag.
{
Char $Read-Flag 1 $Status

{
{ Get rid of the original "Read/Unread" flag,
{ but preserve the other flag.
{
ChopString $Status 1 1

Set $TargetMailbox $ReadMailbox
If $Read-Flag = U Then Mark-Read

Set $TargetMailbox $UnreadMailbox
If $Read-Flag = R Then Mark-UnRead

{
{ Just exit if no "Read/Unread" flag found.
{
Exit

{
{ Insert the toggled "Read/Unread"  flag in $Status.
{
:Mark-Read
InsertString $Status 1 R
GoTo Replace-Status-Header
       
:Mark-UnRead
InsertString $Status 1 U
   
{
{ Replace the original Status-Header with
{ the updated $Status value.
{
:Replace-Status-Header
DeleteHeader $Status-Header %message
AddHeader %message $Status-Header $Status
If $AutoMove ! "yes" Then Done

AppendToFile True
SaveMessage %message $TargetMailbox
DeleteMessage %message

:Done   
Exit


Setup the mailboxes using the "Setup" tab of the script window. You will also have to set the "Automatically move messages" parameter to "Yes". I set it up this way so as to not disrupt current users.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Script for moving mail

Postby mig62 » Wed Sep 29, 2004 4:47 am

Thank you very much. It works great.
mig62
 


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 1 guest

cron