Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

help with trivial emailgetter

 [1/5] from: bry::itnisk::com at: 31-Oct-2002 12:50


Can you tell me the syntactical error I am making which keeps my messages from being removed from my server, the line I am assuming should remove the message is "remove first messages" : REBOL[Title "emailgetter"] mailbox: [ scheme: 'pop host: "hostname" user: "username" pass: "password" ] messages: read mailbox num-messages: length? messages while [not tail? messages] [ msg: import-email first messages filename: rejoin[ trim msg/subject num-messages ".txt"] write to-file filename msg/content remove first messages num-messages: num-messages - 1 messages: next messages ]

 [2/5] from: philb:upnaway at: 31-Oct-2002 22:08


Hi, Dont think you need the message: next message as the remove first messages will remove the first entry in the list of messages Cheers Phil === Original Message === Can you tell me the syntactical error I am making which keeps my messages from being removed from my server, the line I am assuming should remove the message is "remove first messages" : REBOL[Title "emailgetter"] mailbox: [ scheme: 'pop host: "hostname" user: "username" pass: "password" ] messages: read mailbox num-messages: length? messages while [not tail? messages] [ msg: import-email first messages filename: rejoin[ trim msg/subject num-messages ".txt"] write to-file filename msg/content remove first messages num-messages: num-messages - 1 messages: next messages ]

 [3/5] from: anton:lexicon at: 1-Nov-2002 1:20


That should be: remove messages Anton.

 [4/5] from: gscottjones:mchsi at: 31-Oct-2002 10:20


From: "bryan"
> Can you tell me the syntactical error I am making which keeps my > messages from being removed from my server, the line I am assuming
<<quoted lines omitted: 16>>
> messages: next messages > ]
Hi, Bryan, If I am reading your code correctly, you have created a copy of all your messages in the pop server and assigned the word messages to that information. 'read on the pop protocol (all, actually) open and coses the connection. You are no longer connected to the server. The 'remove action will only be performed on the block that contains these messages. The server remains untouched. To remove messages from the server, one "opens" the servers, gets the goods, then "removes" on the srver port, then closes. Since I rarely use pop from REBOL, it will be safer to refer you to the documentation. More can be found at: http://www.rebol.com/docs/core23/rebolcore-13.html#sect10. Hope that helps. If it doesn't, feel free to reask. --Scott Jones

 [5/5] from: greggirwin:mindspring at: 31-Oct-2002 10:56


Hi Bryan, You got the syntax question answered, so I'll just add a semantic note. You're doing a REMOVE on the block, then also doing a NEXT to move it forward, so what's going to happen is that you're going to skip every other item. Paste this into the console to see what I mean. messages: [1 2 3 4 5 6] while [not tail? messages] [ print first messages remove messages messages: next messages ] head messages On the syntax side, the reason you need to get rid of FIRST you probably already know now. It returns the first value of a series, not a series itself, and REMOVE needs a series to operate on. Now, could it ever have worked? Yes. Try this: messages: [[1 2 3] [4 5 6]] remove first messages head messages You wouldn't have gotten an error had the first item in your series been a series itself, but you probably wouldn't have gotten the expected result either. HTH! --Gregg

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted