Jump to content

Sleep("absolute-time") ?


Recommended Posts

How would you implement this notion?

Suppose you want a certain script to begin

processing at 3:00 pm, but you need to be

able to start the script anytiime before that,

you need your first statement to be one

that will pause and wake up at 3:00 pm -

is there a command for that?

Littleberry

Link to comment
Share on other sites

Just use the time funtions:

Hotkeyset("{pause}","bypass"); hit pause to start before
$x=1
While @HOUR<>15 and $x=1
sleep(10)
wend
; at 3:00pm this will start

func bypass()
$x=0
endfunc

edit...

you can also have it start anytime after it with:

Hotkeyset("{pause}","bypass"); hit pause to start before
$x=1
While @HOUR<15 and $x=1
sleep(10)
wend
; at 3:00pm this will start

func bypass()
$x=0
endfunc
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Many thanks!

Now that I see how to get the current time (using the @ sign),

I wrote this short "difference" code that worked - avoids looping.

$h1 = 15 ; start hour

$m1 = 30 ; start minute

$s1 = 00 ; start second

$tots = $s1 + (60 * ($m1 + (60 * $h1))) ; total seconds after midnight to start

$curs = @SEC + (60 * (@MIN + (60 * @HOUR))) ; elapsed seconds since midnight

$delta = $tots - $curs ; number of seconds to wait before starting starting

Sleep( $delta * 1000 ) ; sleep until 3:30 pm (I hope ...)

MouseClick("left")

I just checked it out and it works.

What I need is a way to pass the desired hours, minutes, and seconds

to the script when I run it - I'll see if I can read the help file as

to how to do that.

Thanks, this forum has some very helpful folks,

Littleberry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...