[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 - Ebay Items

Ebay Items

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

Ebay Items

Postby usandstuff » Fri May 27, 2005 7:13 pm

Help,
I'm trying to create a script which will do the following.

1) Get the Item ID from an Ebay subject line
2) Check to see if a mailbox exists with the ID number as it's name
3) If not, create a mailbox with the ID number as the name
4) Move the message to the mailbox

It sounds complicated and I'm not sure where to start.


Thanks

:?
usandstuff
New Arrival
 
Posts: 4
Joined: Fri May 27, 2005 7:08 pm

Re: Ebay Items

Postby Eric » Fri May 27, 2005 11:55 pm

Hi usandstuff & welcome to Poco Forums, :D
usandstuff wrote:Help,
I'm trying to create a script which will do the following.
It sounds complicated and I'm not sure where to start.

Have a look at Script to create a sub-mailbox?.

Another reference: the unofficial Pocomail FAQ.

Can't help you much more, but it's a start. :?

We'll have to wait until someone else who knows more about scripts can help you more. :wink:
Eric
 

Postby Pete » Sun May 29, 2005 7:16 am

Actually, PocoScript makes this easier than it sounds. PocoScript automatically creates mailboxes if they don't already exist.

I would start with the script that I posted here:
http://pocosystems.com/forum/viewtopic.php?t=2165

You'll just have to add some logic to the beginning of it and then replace the "To Do" phrase with a variable.

If you post a sample email subject, someone should be able to help.
Pete
 

Postby usandstuff » Wed Jun 01, 2005 7:06 am

A typical ebay subject line is:

eBay Bid Confirmed: HOYA CIR-POLARISING FILTER 58.0s (Item #7517985466)

I want to pull the item number and create a mailbox if it doesn't already exist, then move the message to it.

Thanks
usandstuff
New Arrival
 
Posts: 4
Joined: Fri May 27, 2005 7:08 pm

Postby Pete » Wed Jun 01, 2005 7:19 am

This is how I would do this:
Code: Select all
Set $root "In\\Ebay"

ReadHeader $subject "Subject:" %message
StringPos #index "(Item #" $subject
If #index = 0 Then DONE
AddIntegers #index 6   { Ignore (Item #
ChopString $subject 1 #index
Trim $subject
CharCount #size $subject
ChopString $subject #size 1
Set $mailbox ""
AddStrings $mailbox $root \ $subject
SaveMessage %message $mailbox
DeleteMessage %message

:DONE
Exit


It will save it to a top-level mailbox. If you want to save it to a submailbox, then I can add logic to the script if you give me an example submailbox name (e.g. In\Ebay or Folder1\Folder2\Ebay\Items or whatever).
Last edited by Pete on Thu Jun 02, 2005 1:50 am, edited 1 time in total.
Pete
 

Postby usandstuff » Wed Jun 01, 2005 5:11 pm

Many thanks for the replies,
If you can just let me know how to create the mailboxes for an example of
In\Ebay\Mailbox, I'll figure the rest of the Subs.
Also, what does "AddIntegers #index 6" do, as there are 9 numbers in the ebay item code, should this be AddIntegers #index 9?

Thanks again

Usandstuff
usandstuff
New Arrival
 
Posts: 4
Joined: Fri May 27, 2005 7:08 pm

Postby Michael » Wed Jun 01, 2005 6:38 pm

Use double backslashes in place of single ones (Poco treats the backslash as an escape character). E.g., In\\Ebay\\Mailbox

The AddIntegers command adds 6 to the value stored in variable #index. This was accounting for the number of characters in the string "Item #".
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby Pete » Thu Jun 02, 2005 1:51 am

Okay, you're welcome. I've updated the script (above).
Pete
 

Postby usandstuff » Thu Jun 02, 2005 4:45 pm

Thanks for this,
I'll have a play this weekend and see what happens.

UsAndStuff :D
usandstuff
New Arrival
 
Posts: 4
Joined: Fri May 27, 2005 7:08 pm


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron