Jump to content

Sleep and Timer Help


Recommended Posts

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
Link to comment
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.

Link to comment
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!!!

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...