jacky998877 Posted December 11, 2022 Posted December 11, 2022 how to use a single hot key to pause and continue the script?
Solution Musashi Posted December 11, 2022 Solution Posted December 11, 2022 Try this as an example : #include <Timers.au3> HotKeySet("{PAUSE}", _TogglePause) HotKeySet("{ESC}", _Terminate) Global $g_bPaused = False Global $hStarttime = _Timer_Init() ; *** just as an info While True ToolTip("Time : " & StringFormat("%.2f", _Timer_Diff($hStarttime) / 1000) & " sec") Sleep(100) WEnd Func _TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(50) ToolTip('Script is paused', 10, 10, "Status :", 1, 1) WEnd ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate jacky998877 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
jacky998877 Posted December 11, 2022 Author Posted December 11, 2022 29 minutes ago, Musashi said: Try this as an example : #include <Timers.au3> HotKeySet("{PAUSE}", _TogglePause) HotKeySet("{ESC}", _Terminate) Global $g_bPaused = False Global $hStarttime = _Timer_Init() ; *** just as an info While True ToolTip("Time : " & StringFormat("%.2f", _Timer_Diff($hStarttime) / 1000) & " sec") Sleep(100) WEnd Func _TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(50) ToolTip('Script is paused', 10, 10, "Status :", 1, 1) WEnd ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate IT WORKS MAN, THANK U😁
Developers Jos Posted December 11, 2022 Developers Posted December 11, 2022 5 minutes ago, jacky998877 said: IT WORKS MAN, THANK U😁 You could also have simply have opened the Helpfile and search for the term hotkey. You would have found an example that exactly does what you requested! 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.
jacky998877 Posted December 11, 2022 Author Posted December 11, 2022 13 minutes ago, Jos said: You could also have simply have opened the Helpfile and search for the term hotkey. You would have found an example that exactly does what you requested! hm.... interesting Werty 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now