Jump to content

How do I pause all other functions?


Recommended Posts

Hi, I'm new into this, I have been learning for 2 days but I couldn't figure out how to stop other functions while "Func Pause ()" is activated, I want the program to rest for 15 minutes after pressing ESC and mouseclick then after that will continue all functions in the program again without closing the program. Is this possible? Thank you.

HotKeySet("{END}", "End")
HotKeySet("{HOME}", "Start")

While 1
    Sleep(100)
WEnd

Func Start()
    While 1
        Pause()
        CHECK()
        PLAY()
    WEnd
EndFunc   ;==>Start


Func Pause()
    PixelSearch(712, 137, 906, 244, 0xA60000)
    If @error Then
        Send("{ESC}")
        Sleep(1000)
        Send("^" & MouseClick("left", 504, 409, 1, 1) & "")

        Sleep(900000)
    EndIf
EndFunc   ;==>Pause

Func CHECK()
    PixelSearch(115, 213, 116, 641, 0xF00000)
    If Not @error Then
        Run("C:\Program Files (x86)\The KMPlayer\KMPlayer.exe")
    EndIf
EndFunc   ;==>CHECK

Func PLAY()
    If (PixelGetColor(290, 115) == 0x000000) Then
        Send("{F1}")

        Sleep(1000)

        Send("{F2}")
    EndIf
EndFunc   ;==>PLAY



Func End()
    Exit 0
EndFunc   ;==>End

 

Edited by Jos
Tidied code and added codebox
Link to comment
Share on other sites

  • Developers
5 hours ago, plankton said:

pressing ESC and mouseclick then after that will continue all functions in the program again without closing the program. Is this possible?

Yes, just do not use the sleep() like you do now, but rather set an indicator variable for pause and test on that in the main loop. This will allow you to keep on doing other things.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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