wellmonster Posted February 22, 2010 Share Posted February 22, 2010 Hi all, I'v recently started using this great tool, i'v ran into a lil problem.. at the moment i'm simply makeing a scipt that is pressing 2 continuesly in a loop. just so i can lear how to use everything.. useing koda i'v made somewhat of a gui with a Start and pause button.. i'v managed to make the start button work with While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start While 1 send("{2}") send("{2}") WEnd EndSwitch WEnd "$Start" being one of the buttons, I also have the button "$pause" how can I link this in. thank you kindly Link to comment Share on other sites More sharing options...
notsure Posted February 22, 2010 Share Posted February 22, 2010 I think its better to set a hotkey for a Pause. You are using an endless loop, the pause-button will never be reached in the code while in that loop. So you better do something like this; #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 454, 192, 114) $start = GUICtrlCreateButton("start", 320, 232, 105, 49, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Paused HotKeySet("{PAUSE}", "TogglePause") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start while 1 tooltip($paused) WEnd EndSwitch WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',200,200) WEnd ToolTip("") EndFunc Link to comment Share on other sites More sharing options...
wellmonster Posted February 22, 2010 Author Share Posted February 22, 2010 I think its better to set a hotkey for a Pause. You are using an endless loop, the pause-button will never be reached in the code while in that loop. So you better do something like this; #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 454, 192, 114) $start = GUICtrlCreateButton("start", 320, 232, 105, 49, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $Paused HotKeySet("{PAUSE}", "TogglePause") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $start while 1 tooltip($paused) WEnd EndSwitch WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',200,200) WEnd ToolTip("") EndFunc I see. thank you very much. i'll let you no how it goes. hmm.. woudl their then be a way to link that button to the puase key? not realy a big issue but if its simple.. thanks again.. Link to comment Share on other sites More sharing options...
wellmonster Posted February 22, 2010 Author Share Posted February 22, 2010 I see. thank you very much. i'll let you no how it goes. hmm.. woudl their then be a way to link that button to the puase key? not realy a big issue but if its simple.. thanks again..is working beautifuly, thank you. 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