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

checkbox interrupting loop

$
0
0

Hello, I want to make a GUI to my script but I cannot figure out how to make checkboxes interrupt a function.

Here is a part of my script:

AutoIt         
#include <GUIConstantsEx.au3> #Include <GuiListView.au3> #Include <Date.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #Include <GuiScrollBars.au3> #NoTrayIcon Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) $Form1 = GUICreate("asd", 280, 280, 193, 90) $ButtonSeg = GUICtrlCreateCheckbox("", 220, 215, 55, 20) $cfko = 1 $hwnd = 0 TraySetState() GUISetState(@SW_SHOW) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $ButtonSeg         _SEG()     EndSwitch WEnd Func _SEG() If (GUICtrlRead($ButtonSeg) = 1) Then     $ClientName = GUICtrlRead(GUICtrlRead($listviewCLIENT))     $FixSeg = StringRegExpReplace($ClientName, "[|]", "")     $hwnd = WinGetHandle($FixSeg) If @Error Then     MsgBox(0, "Error", "Sorry, the handle could not be found.")     Exit EndIf AdlibRegister("curse",13500) AdlibRegister("skill2",500) AdlibRegister("skill3",500) AdlibRegister("skill4",500) AdlibRegister("manapot",50000) While 2 If $cfko = 1 Then     AdlibUnRegister("skill2")     AdlibUnRegister("skill3")     AdlibUnRegister("skill4")     Sleep(500)     Adlibregister("CFspam",500) ; 9x Curse Field again (for sure cast)     Sleep(4510)     AdlibUnregister("CFspam")     Sleep(500)     ControlSend($hwnd, "", "", "{1}") ; Heal     Sleep(1000)     AdlibRegister("skill2",500)     AdlibRegister("skill3",500)     AdlibRegister("skill4",500)     $cfko = 0 EndIf WEnd ElseIf (GUICtrlRead($ButtonSeg) = 0) Then     $cfko = 0     AdlibUnregister("curse")     AdlibUnregister("skill2")     AdlibUnregister("skill3")     AdlibUnregister("skill4")     AdlibUnRegister("manapot") EndIf EndFunc Func curse()     ControlSend($hwnd, "", "", "{3}") ; Curse Field     $cfko = 1 EndFunc Func CFspam()     ControlSend($hwnd, "", "", "{3}") EndFunc Func skill2()     ControlSend($hwnd, "", "", "{4}") ; AOE 1 EndFunc Func skill3()     ControlSend($hwnd, "", "", "{5}") ; AOE 2 EndFunc Func skill4()     ControlSend($hwnd, "", "", "{6}") ; AOE 3 EndFunc Func manapot()     ControlSend($hwnd, "", "", "{F2}") EndFunc

I would like it to send key "4 5 6" every 500 ms, when it sends key "3" - every 13,5 sec, the 456 sending should stop, send 3 again a few times and then send 1...then continue.

 

It worked good but I created a GUI with a checkbox.

 

I dont know how to make it like this - When the checkbox is checked, the keys are being sended.

When I uncheck the checkbox, the keys shouldnt be sended. (idk how to interrupt the loop)

 

Hope my question is clear -_-


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>