Maurizio Posted October 20, 2020 Share Posted October 20, 2020 Hi Foro Using Koda to create this interface, I noticed that the start key when clicked, starts the program, but at each step of the Wile loop, it must be clicked again. How can this situation be remedied? Thank you expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 40, 48, 537, 97) $Input1 = GUICtrlCreateInput("Input1", 64, 72, 89, 21) $Input2 = GUICtrlCreateInput("Input2", 216, 72, 105, 21) $Input3 = GUICtrlCreateInput("Input3", 392, 72, 113, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Avvia = GUICtrlCreateButton("Avvia", 232, 224, 137, 49) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Avvia Sleep(5000) MouseClick("left", 559, 502, 1) Sleep(5000) MouseClick("left", 717, 262, 1) $value = GUICtrlRead($Input1) Send($value, "") Sleep(2000) MouseClick("left", 878, 263, 1) $value1 = GUICtrlRead($Input2) Send($value1, "") Sleep(2000) MouseClick("left",939, 263, 1) sleep(3000) Case $Input3 $Input = GUICtrlRead($Input3) If $Input > 0 And $Input <= 15 Then Switch $Input3 Case 1 EndSwitch WEnd Link to comment Share on other sites More sharing options...
Dan_555 Posted October 21, 2020 Share Posted October 21, 2020 It can be done like this: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Group1 = GUICtrlCreateGroup("Group1", 40, 48, 537, 97) $Input1 = GUICtrlCreateInput("Input1", 64, 72, 89, 21) $Input2 = GUICtrlCreateInput("Input2", 216, 72, 105, 21) $Input3 = GUICtrlCreateInput("Input3", 392, 72, 113, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $Avvia = GUICtrlCreateButton("Avvia", 232, 224, 137, 49) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $looptest = -1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Avvia $looptest = -$looptest Case $Input3 $Input = GUICtrlRead($Input3) If $Input > 0 And $Input <= 15 Then Switch $Input3 Case 1 EndSwitch EndIf EndSwitch If $looptest = 1 Then StartingLoop() EndIf WEnd Func StartingLoop() Sleep(5000) MouseClick("left", 559, 502, 1) Sleep(5000) MouseClick("left", 717, 262, 1) $value = GUICtrlRead($Input1) Send($value, "") Sleep(2000) MouseClick("left", 878, 263, 1) $value1 = GUICtrlRead($Input2) Send($value1, "") Sleep(2000) MouseClick("left", 939, 263, 1) Sleep(3000) EndFunc ;==>StartingLoop but, the button to stop it will work only when the StartingLoop has been done, and if i have counted right, it means every 18 seconds it would be useable. Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 22, 2020 Author Share Posted October 22, 2020 Perfect works great. Thank you very much, after long in vain searches you solved the problem for me :). 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