Sign in to follow this  
Followers 0
EuphoricApathy

Sleep and Timer Help

6 posts in this topic

#1 ·  Posted (edited)

I have a working script in autoit. I would like this script to run for 30 minutes,sleep for 1 minute and then continue.

My script is looped so that it runs forever until i press esc.

How can i accomplish this?

The script below is just an example,if you want(it would be helpful) if you use it to show an example of how to accomplish this.

func exitthescript()
   Exit
EndFunc

HotKeySet( "{ESC}", "exitthescript" )

while 1
   
   MouseClick("left", 1 )

   WEnd

I know that i probably need to use a timer,and the sleep commands.

im just unsure about using it with my loop.

imanoob sorries >.<

Edited by EuphoricApathy

Share this post


Link to post
Share on other sites



Func exitthescript()
    Exit
EndFunc   ;==>exitthescript

HotKeySet("{ESC}", "exitthescript")

$Timer = TimerInit()

While 1
    
    If TimerDiff($Timer) >= 30 * (1000 * 60) Then
        Sleep(1000 * 60)
        $Timer = TimerInit()
    EndIf

    MouseClick("left", 1)

WEnd


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Func exitthescript()
    Exit
EndFunc   ;==>exitthescript

HotKeySet("{ESC}", "exitthescript")

$Timer = TimerInit()

While 1
    
    If TimerDiff($Timer) >= 30 * (1000 * 60) Then
        Sleep(1000 * 60)
        $Timer = TimerInit()
    EndIf

    MouseClick("left", 1)

WEnd

Thats it? This will keep my script running forver(till i press esc) have it sleep for 1 min every 30 min, and then continue?

Thankyou!!!

Share this post


Link to post
Share on other sites

Well earth might explode before forever but, yes, I suppose.

lol,thx,tested it and its working fine.

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