[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 - Popfile Script

Popfile Script

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Popfile Script

Postby gavinjb » Fri Aug 21, 2009 7:30 am

Hi,

I am trying to write a script that will update the Header in an Email with a value selected and then Mark a Message followed by opening web browser with the page to update the popfile link.

So far my script errors on both the Mark Message and when I try to update the header info in a message, but it runs the browser bit fine!

Code: Select all
{### update_popfile_classification }

{ Script will update the popfile classificatino for message }

{ Please notee this has only been tested on Barca2 }

{ Usage: to be run manually }

InputBox $userdata1 "Select Bucket to Re-Classify Email to: %var%" "bills|blogs|orders|other|personal|search|spam|work"

{ ReadHeader $Class "X-Text-Classification:" %message
DeleteHeader "X-Text-Classification:" %message
AddHeader %message "X-Text-Classification:" $userdata1

AppendToFile True
SaveMessage %message $mailbox
DeleteMessage %message

If $userdata1 = "bills" Then bills
If $userdata1 = "blogs" Then blogs
If $userdata1 = "orders" Then orders
If $userdata1 = "other" Then other
If $userdata1 = "personal" Then personal
If $userdata1 = "search" Then search
If $userdata1 = "work" then work

Goto popfile

:Leave
MarkMessage $message 0
Exit

:bills
  MarkMessage %message 3
  GoTo popfile
:blogs
  MarkMessage %message 6
  GoTo popfile
:orders
  MarkMessage %message  5
  GoTo popfile
:other
  MarkMessage %message 2
  GoTo popfile
:personal
  MarkMessage %message 4
  GoTo popfile
:search
  MarkMessage %message 8
  GoTo popfile
:work
  MarkMessage %message 7
  GoTo popfile

:popfile
ReadHeader $Link "X-POPFile-Link:" %message
Execute $Link
GoTo Leave


When it tries to mark the message I get the following error, even though form what I can see I am using the correct syntax from the help:

First parameter for MarkMessage has to be a message variable (%var)

But when I try and run the update of the headers I get the following:

Variable not previously declared: $mailbox (if this is the case what do I use to tell the script which mailbox?)

Thanks,



Gavin,
gavinjb
Frequent Visitor
 
Posts: 56
Joined: Mon Jan 24, 2005 11:41 pm
Location: Reading, UK

Postby MarkB » Sat Aug 22, 2009 4:17 am

1. Change $userdata1 to $bucket throughout. Reserve $userdata1 for use with the External command.

2. The variable $mailbox is not defined. Define it with a Set command, or replace it with the system variable $CurrentMailbox if that is what you want.

3. Change
MarkMessage $message 0
to
MarkMessage %message 0

4. Under "Leave," just before the script exits, the message gets marked with a 0 -- undoing whatever mark it received an instant before.

5. Mark the message before you do your SaveMessage, DeleteMessage.
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby MarkB » Tue Aug 25, 2009 12:49 am

Is your script working now?
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