Sorry, that was not working code.. just to illustrate..
Here is working example (i hope)

process := [

[ | now when |

now := Time now asDuration.
when := 0 hours + 30 minutes.
when < now ifTrue: [ when := when + 24 hours ].
(Delay forDuration: when - now) wait.

  ... do your stuff here ...

] repeat.

] newProcess.

process name: 'My periodic stuff'.
process resume

On 13 May 2010 00:38, Igor Stasenko <[email protected]> wrote:
> Something like that:
>
> process := [
>
> [ [
>     | now when |
>     now := Time now.
>     when := 1 hour + 24 minutes.  "past midnight"
>     now = when
>  ] whileFalse: [ 30 seconds asDelay wait ].
>
>  ... do your stuff here .....
>
>  2 minutes asDelay wait. "make sure we're not repeat the same thing
> within same day"
> ] repeat
>
> ]  newProcess.
>
> process name: 'My periodic stuff'.
> process resume
>
>
> 2010/5/12 Andrei Stebakov <[email protected]>:
>> Could you please give me an example of that usage?
>>
>> On Wed, May 12, 2010 at 4:48 PM, Igor Stasenko <[email protected]> wrote:
>>>
>>> its a bit heawyweight to use VM as command-line tool.
>>> you could, intead run pharo in persistent mode,
>>> and schedule the same piece of code to run periodically as background
>>> process in it.
>>>
>>> 2010/5/12 Andrei Stebakov <[email protected]>:
>>> > I think that scripting support is essential for any interpreted language
>>> > and
>>> > if Pharo had it, its community would grow much faster.
>>> > Let's say, I learned now how to use HTML parsing in the GUI version of
>>> > Pharo.
>>> > I went ahead and created my own class (or set of classes) in the image
>>> > which
>>> > can say retrieve a dollar rate from some bank web page.
>>> > Now I should be able to run Pharo in a "batch mode" saying something
>>> > like...
>>> > "./pharo -batch "DollarRateInfo :getAndSendEmail '[email protected]".
>>> > This way I could schedule this command using cron to send me this dollar
>>> > rate via email every day at 2 pm. Having this functionality I could
>>> > really
>>> > spend more time using Pharo for different needs and get better at using
>>> > it.
>>> >
>>> > I don't think it should be too hard to implement (please correct me if I
>>> > am
>>> > wrong). In the batch mode pharo would start in a "headless mode", read
>>> > some
>>> > input from a standard input (or from command line), execute it in a
>>> > 'hidden'
>>> > Workspace and send the output of the evaluation to the standard output.
>>> >
>>> > Thank you,
>>> > Andrei
>>> >
>>> >
>>> > On Wed, May 12, 2010 at 4:15 PM, Stéphane Ducasse
>>> > <[email protected]> wrote:
>>> >>
>>> >> unfortunately I did not find the time to continue working on it but I
>>> >> would love to.
>>> >>
>>> >> On May 12, 2010, at 9:50 PM, Gabriel Brunstein wrote:
>>> >>
>>> >> > What about coral?
>>> >> > http://scg.unibe.ch/wiki/projects/bachelorsprojects/coral
>>> >> >
>>> >> > 2010/5/12 Andrei Stebakov <[email protected]>
>>> >> > Is it possible to start Pharo headless and execute some command (say
>>> >> > to
>>> >> > get some info from a web page)?
>>> >> >
>>> >> > _______________________________________________
>>> >> > Pharo-project mailing list
>>> >> > [email protected]
>>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >> >
>>> >> > _______________________________________________
>>> >> > Pharo-project mailing list
>>> >> > [email protected]
>>> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> Pharo-project mailing list
>>> >> [email protected]
>>> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >
>>> >
>>> > _______________________________________________
>>> > Pharo-project mailing list
>>> > [email protected]
>>> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>> >
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [email protected]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



-- 
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to