huldu Posted December 31, 2005 Share Posted December 31, 2005 I cant get this pause script to work, i got no idea what is wrong to be honest. The pause/break key works fine. The problem is the pause button in the program, it starts the "pause" but it never stops it, doesnt matter how many times you click on the button. This pause thing works great outside the GUI, but inside... the pause button just refuse to stop the pause.#include <GUIConstants.au3>Dim $Paused, $Clicked, $Executed, $NotPausedGlobal $PausedOpt("GUIOnEventMode",1)HotKeySet("{PAUSE}", "PauseButton")$Form1 = GUICreate("Paused", 121, 40, 462, 300)GUISetOnEvent($GUI_EVENT_CLOSE, "ExitProgram")$Button1 = GUICtrlCreateButton("Pause", 24, 8, 75, 25)GUICtrlSetOnEvent(-1, "PauseButton")GUISetState(@SW_SHOW)While 1 $NotPaused = $NotPaused +1 ToolTip("" & "Not Paused: " & $NotPaused,0,0) Sleep(100)WEndExitFunc PauseButton() $Clicked = $Clicked + 1 $Paused = NOT $Paused While $Paused $Executed = $Executed + 1 ToolTip("" & "The script is paused: " & $Clicked & " Ran: " & $Executed,0,0) Sleep(100) WEnd ToolTip("",0,0)EndFuncFunc ExitProgram() Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE Exit EndSelectEndFunc "I'm paper, rock is fine, nerf scissors!!!" Link to comment Share on other sites More sharing options...
Developers Jos Posted December 31, 2005 Developers Share Posted December 31, 2005 I cant get this pause script to work, i got no idea what is wrong to be honest. The pause/break key works fine. The problem is the pause button in the program, it starts the "pause" but it never stops it, doesnt matter how many times you click on the button. This pause thing works great outside the GUI, but inside... the pause button just refuse to stop the pause. The HotKey Pause works fine, but your Pause button doesn't work because after pressing the button the Event is started and never end. so the next click on the button doesn't function. Here is a version that works: expandcollapse popup#include <GUIConstants.au3> Dim $Paused, $Clicked, $Executed, $NotPaused opt("GUIOnEventMode", 1) HotKeySet("{PAUSE}", "PauseButton") $Form1 = GUICreate("Paused", 121, 40, 462, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitProgram") $Button1 = GUICtrlCreateButton("Pause", 24, 8, 75, 25) GUICtrlSetOnEvent(-1, "PauseButton") GUISetState(@SW_SHOW) AdlibEnable("adRoutine") While 1 $NotPaused = $NotPaused + 1 ToolTip("" & "Not Paused: " & $NotPaused, 0, 0) Sleep(100) WEnd Exit Func PauseButton() $Clicked = $Clicked + 1 $Paused = Not $Paused EndFunc ;==>PauseButton Func ExitProgram() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>ExitProgram Func adRoutine() While $Paused $Executed = $Executed + 1 ToolTip("" & "The script is paused: " & $Clicked & " Ran: " & $Executed, 0, 0) Sleep(100) WEnd ToolTip("", 0, 0) EndFunc ;==>PauseButton 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 More sharing options...
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