Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Using a gui button to control togglepause

$
0
0

I want to start my script paused and when I click the pause button I want it to unpause the script. I would also like the pause button to say unpaused when the script is not paused.

AutoIt         
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $Paused $Paused = $Paused #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 377, 280, 192, 114) $Input1 = GUICtrlCreateInput("10", 24, 40, 49, 21) $Input2 = GUICtrlCreateInput("", 24, 72, 49, 21) $Input3 = GUICtrlCreateInput("", 24, 104, 49, 21) $Input4 = GUICtrlCreateInput("", 24, 136, 49, 21) $Input5 = GUICtrlCreateInput("23", 24, 168, 49, 21) $Input6 = GUICtrlCreateInput("", 240, 40, 49, 21) $Input7 = GUICtrlCreateInput("", 240, 72, 49, 21) $Input8 = GUICtrlCreateInput("", 240, 104, 49, 21) $Input9 = GUICtrlCreateInput("", 240, 136, 49, 21) $Input10 = GUICtrlCreateInput("", 240, 168, 49, 21) $Pause = GUICtrlCreateButton("Pause", 24, 216, 97, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### TogglePause() While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $Pause             TogglePause()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd Func TogglePause()                    ;<==========================Here     $Paused = Not $Paused     While $Paused         Sleep(100)         ToolTip('Paused', 0, 0)     WEnd     ToolTip("") EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles