Sign in to follow this  
Followers 0
littleberry

Sleep("absolute-time") ?

4 posts in this topic

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

Share this post


Link to post
Share on other sites



$i = 0
While $i = 0
if $a = 15 then exitloop
sleep(50000)
$a = @HOUR
WEnd
the code to execute down here.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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.

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0