Is there a cron is Cygwin or PPT? That may be a good idea for this. I'm currently unsure about those offerings.

Your best option for now may be to have your script run at startup from a run key in the registry or from the startup program group. Then, in order to do what you want every so often, put the code that performs the action in a loop and include a sleep $seconds; statement at the beginning or end of the loop.

If more accurately spacing the times (depending on various running times of your program) is a priority, you can start the loop like this:
my $interval = 600; #for ten minutes, adjust as needed my $time_to_work = time() + $interval;
And end it like this:
sleep ($time_to_work - time());
I should point out that this is not pretty even in my mind, but I've used similar code before when running time was variant on input or on network load. You can move the first part (excepting the declarations, of course) to the bottom of the loop and the last part to the top of the loop in order to make it wait before instead of after your main work.

This means your code is always running, but it's usually taking up (at least very close to) no processor time.

Christopher E. Stith

In reply to Re^3: Mail & Win32 by mr_mischief
in thread Mail & Win32 by Mitch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.