AXPER

skip sleep or exit

5 posts in this topic

My question is I use sleep time
But sometimes I want to skip or stop sleep timer
for Using an external button
Any Help for this code

Sorry for my poor English

 

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            Case $Button1
            for $i =1 to 12 Step 1
        Sleep (5000)
        Call ("login")
        sleep (600000)
    
        Case $Button2 ; ---> Stop the sleep time

            Next
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



Use TimerInit and TimerDiff instead.

 

Saludos

 

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or do this :

add Global $wait = xxx

replace Sleep(###) with Sleep($wait) and under that add $wait = xxx this makes sure $wait is once again the number it should be next time you press $button1

add under Case $button2  If $wait >= 1 Then $wait = 0 EndIf

That should make $button2 only stop the sleep timer.

XXX = the amount of time you want sleep to execute

### = the sleep(time) which you want to be able to stop

Edited by xxaviarxx
1 person likes this

Share this post


Link to post
Share on other sites

Use TimerInit and TimerDiff instead.

 

Saludos

 

Or do this :

add Global $wait = xxx

replace Sleep(###) with Sleep($wait) and under that add $wait = xxx this makes sure $wait is once again the number it should be next time you press $button1

add under Case $button2  If $wait >= 1 Then $wait = 0 EndIf

That should make $button2 only stop the sleep timer.

XXX = the amount of time you want sleep to execute

### = the sleep(time) which you want to be able to stop

Thank you for the idea

Share this post


Link to post
Share on other sites

No problem hope everything you are trying to do works out for you.

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