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

using an event to periodically check a pop server for email.

 [1/7] from: steve:shireman:semaxwireless at: 26-Jun-2001 10:02


I am using a face feel event, set at 120 seconds, to try to download emails by an email bot. I made an engage: function to do the read //pop: ... in the context of the face. (of course, this can take many seconds to do) My goal is to parse through the emails, and pull out the valid data, but I think this is killing the GUI of View. ----------- area 400x55 "Current GPS location = 39 17.4446 N 094 40.5533 W" rate 120 feel[ engage: func [face act evt][ ; this next step may take a long time, and maybe is in wrong context? mailbox: read pop://semax025:[ankle1--www--semaxwireless--com] foreach msg skip mailbox prior-len [ msg: import-email msg from: first msg/from if all [ find trusted-sources from parse/all msg/subject GPS-rule ][ face/text: reduce ["current GPS data" msg/subject] ] ] prior-len: length? mailbox show face ] ] -------------- any tips or ideas? Thanks, Steve Shireman

 [2/7] from: cyphre:volny:cz at: 26-Jun-2001 17:36


Hello Steve, you should put the whole code inside 'engage function into following condition: if act = 'time [ >>put function code here<<] Then the parsing is done just only when the time event from rate is going thru the face. Maybe this would help you.... Regards, Cyphre ----- Original Message ----- From: "Steve Shireman" <[steve--shireman--semaxwireless--com]> To: <[rebol-list--rebol--com]> Sent: Tuesday, June 26, 2001 5:02 PM Subject: [REBOL] using an event to periodically check a pop server for email.

 [3/7] from: arolls:bigpond:au at: 27-Jun-2001 2:19


You could launch another rebol process each 120 seconds to do the work? or Split your work up into several parts. Increase your rate to about 1, so that the work gets done in a reasonable time. Maintain two variables: job-part: 0 ; stores which part of the job you are up to. counter: 0 ; counts up to 120 seconds So, as each 'time event comes along, increment counter until it gets to 120 seconds worth. When 120, fire up your job by incrementing job-part up to the maximum of jobs. if non-zero, do the job indicated by job-part. Kind of a state machine. Hang on, code is easier:-) ; assuming rate 1 if evt = 'time [ if 120 = counter: counter + 1 [ counter: 0 ; reset the counter ; start the job (starting with the first part). job-part: 1 ] switch job-part compose [ 0 [] ; do nothing 1 [ ; read email here job-part: job-part + 1 ] 2 [ ; parse through each email here ; (maintain a second job-part counter ; here to process each email) job-part: job-part + 1 ] 3 [ ; send each email here ; (maintain that second job-part counter ; again to process each email) job-part: job-part + 1 ] 4 [ ; do last part here job-part: 0 ; we are finished ] ] ] or Perhaps you can just insert [wait none] between your job parts. (Just be sure to avoid infinite loop. Use a flag to indicate that your job is in progress). Anton.

 [4/7] from: steve::shireman::semaxwireless::com at: 26-Jun-2001 11:24


Cyphre. Thanks for the tip. -but, I tried it and it didn't fix it. When I put the same code in the action part of a button, it works OK. Of course, this is in the View with /Link, so maybe I better try it in /ViewPro 1.2.1... Steve Shireman Richard Smolak wrote:

 [5/7] from: agem:crosswinds at: 26-Jun-2001 19:27


RE: [REBOL] Re: using an event to periodically check a pop server for email. [arolls--bigpond--net--au] wrote:
> You could launch another rebol process > each 120 seconds to do the work? >
Ah! i got it :) 120 SECONDS.. rate 00:00:120 [rebol[title: "flickering"] view layout[ box blue rate 120 feel[ engage: func[face a e][if 'time = a [ face/color: get random/only[blue green yellow] show face ]]]]] ;-) Volker

 [6/7] from: steve:shireman:semaxwireless at: 26-Jun-2001 12:54


Oih!!! A thousand Doih's I was doing rate of 120 thinking it was seconds, instead of 00:02:00 time like for 2 minutes. Now it is working! so 120 meant 120 times a second! Sorry for the bandwidth usage. Steve Shireman a script in time saves nine Rebol-sewing the fabric of the future Anton wrote:

 [7/7] from: steve:shireman:semaxwireless at: 26-Jun-2001 13:38


Yeah, thats it. Steve Time can change me, but I just get I-rate.. [agem--crosswinds--net] wrote: