Sign in to follow this  
Followers 0
ulti

Cant kill script from looping

5 posts in this topic

heya guys :D i beleve this to be a simple thing, i have a loop running when i press start on gui providing check box anti afk is checked. if i unchecked that check box the script stops working which is good, all tho when i press the stop button wicth unchecks the box while script isnt running wont do the same while it running any ideas?

#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
Opt("TrayIconDebug",1)
$mainwindow = GUICreate("Auto W0W", 313, 220, 298, 134)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$Start = GUICtrlCreateButton("Start", 32, 136, 257, 65)
$Fast = GUICtrlCreateButton("Fast", 32, 8, 65, 41)
$Stop = GUICtrlCreateButton("Stop all", 256, 96, 33, 33)
$Medium = GUICtrlCreateButton("Medium", 128, 8, 65, 41)
$Slow = GUICtrlCreateButton("Slow", 224, 8, 65, 41)
$Folow = GUICtrlCreateCheckbox("Auto Folow", 48, 64, 97, 17)
$Afk = GUICtrlCreateCheckbox("Anti Afk", 152, 64, 97, 17)
$Clicker = GUICtrlCreateCheckbox("Clicker", 48, 104, 97, 17)
$Class = GUICtrlCreateCheckbox("Class Ability", 152, 104, 97, 17)
GUICtrlSetOnEvent($Start, "Start")
GUICtrlSetOnEvent($Stop, "stop")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
  Sleep(1000)
WEnd

Func CLOSEClicked()

 If @GUI_WINHANDLE = $mainwindow Then
    Exit
  EndIf
EndFunc



Func Start()

    if GUICtrlRead($Afk) = 1 then
        do
sleep (1000);want this to loop till $Afk is unchecked
send ("{1}")
GUICtrlRead($Afk)
until GUICtrlRead($Afk) = $GUI_UNCHECKED;works if i click the check box it stops the script running
else
    MsgBox(0, "GUI Event", "No Modes selected")
endif
EndFunc


Func Stop();i want on pressing the stop button to uncheck all boxes thus stopping script. but while loop is running the stop button becomes un responsive?
GUICtrlSetState($Folow, $GUI_UNCHECKED)
GUICtrlSetState($afk, $GUI_UNCHECKED)
GUICtrlSetState($Clicker, $GUI_UNCHECKED)
GUICtrlSetState($Class, $GUI_UNCHECKED)
MsgBox(0, "GUI Event", "Stoped")
    EndFunc

Share this post


Link to post
Share on other sites



heya guys :D i beleve this to be a simple thing, i have a loop running when i press start on gui providing check box anti afk is checked. if i unchecked that check box the script stops working which is good, all tho when i press the stop button wicth unchecks the box while script isnt running wont do the same while it running any ideas?

#include <GUIConstantsEx.au3>
 #Region ### START Koda GUI section ### Form=
 Opt("GUIOnEventMode", 1)
 Opt("TrayIconDebug",1)
 $mainwindow = GUICreate("Auto W0W", 313, 220, 298, 134)
 GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
 $Start = GUICtrlCreateButton("Start", 32, 136, 257, 65)
 $Fast = GUICtrlCreateButton("Fast", 32, 8, 65, 41)
 $Stop = GUICtrlCreateButton("Stop all", 256, 96, 33, 33)
 $Medium = GUICtrlCreateButton("Medium", 128, 8, 65, 41)
 $Slow = GUICtrlCreateButton("Slow", 224, 8, 65, 41)
 $Folow = GUICtrlCreateCheckbox("Auto Folow", 48, 64, 97, 17)
 $Afk = GUICtrlCreateCheckbox("Anti Afk", 152, 64, 97, 17)
 $Clicker = GUICtrlCreateCheckbox("Clicker", 48, 104, 97, 17)
 $Class = GUICtrlCreateCheckbox("Class Ability", 152, 104, 97, 17)
 GUICtrlSetOnEvent($Start, "Start")
 GUICtrlSetOnEvent($Stop, "stop")
 GUISetState(@SW_SHOW)
 #EndRegion ### END Koda GUI section ###
 
 While 1
   Sleep(1000)
 WEnd
 
 Func CLOSEClicked()
 
  If @GUI_WINHANDLE = $mainwindow Then
     Exit
   EndIf
 EndFunc
 
 
 
 Func Start()
 
     if GUICtrlRead($Afk) = 1 then
         do
 sleep (1000);want this to loop till $Afk is unchecked
 send ("{1}")
 GUICtrlRead($Afk)
 until GUICtrlRead($Afk) = $GUI_UNCHECKED;works if i click the check box it stops the script running
 else
     MsgBox(0, "GUI Event", "No Modes selected")
 endif
 EndFunc
 
 
 Func Stop();i want on pressing the stop button to uncheck all boxes thus stopping script. but while loop is running the stop button becomes un responsive?
 GUICtrlSetState($Folow, $GUI_UNCHECKED)
 GUICtrlSetState($afk, $GUI_UNCHECKED)
 GUICtrlSetState($Clicker, $GUI_UNCHECKED)
 GUICtrlSetState($Class, $GUI_UNCHECKED)
 MsgBox(0, "GUI Event", "Stoped")
     EndFunc
Trythis

#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
Opt("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1)
$mainwindow = GUICreate("Auto W0W", 313, 220, 298, 134)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

$Start = GUICtrlCreateButton("Start", 32, 136, 257, 65)
$Fast = GUICtrlCreateButton("Fast", 32, 8, 65, 41)
$Stop = GUICtrlCreateButton("Stop all", 256, 96, 33, 33)
$Medium = GUICtrlCreateButton("Medium", 128, 8, 65, 41)
$Slow = GUICtrlCreateButton("Slow", 224, 8, 65, 41)
$Folow = GUICtrlCreateCheckbox("Auto Folow", 48, 64, 97, 17)
$Afk = GUICtrlCreateCheckbox("Anti Afk", 152, 64, 97, 17)
$Clicker = GUICtrlCreateCheckbox("Clicker", 48, 104, 97, 17)
$Class = GUICtrlCreateCheckbox("Class Ability", 152, 104, 97, 17)

GUICtrlSetOnEvent($Start, "Start")
GUICtrlSetOnEvent($Stop, "stop")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$dostart = false
While 1
    Sleep(100)
    if $dostart then start2()
WEnd


Func start2()
  If GUICtrlRead($Afk) = 1 Then
        Do
            Sleep(1000);want this to loop till $Afk is unchecked
            Send("{1}")
            GUICtrlRead($Afk)
        Until GUICtrlRead($Afk) = $GUI_UNCHECKED;works if i click the check box it stops the script running
    Else
        MsgBox(0, "GUI Event", "No Modes selected")
    EndIf
    $dostart = false
EndFunc

Func CLOSEClicked()

    If @GUI_WinHandle = $mainwindow Then
        Exit
    EndIf
EndFunc  ;==>CLOSEClicked



Func Start()
$dostart = true

EndFunc  ;==>Start


Func Stop();i want on pressing the stop button to uncheck all boxes thus stopping script. but while loop is running the stop button becomes un responsive?
    GUICtrlSetState($Folow, $GUI_UNCHECKED)
    GUICtrlSetState($Afk, $GUI_UNCHECKED)
    GUICtrlSetState($Clicker, $GUI_UNCHECKED)
    GUICtrlSetState($Class, $GUI_UNCHECKED)
    MsgBox(0, "GUI Event", "Stoped")
EndFunc  ;==>Stop

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Yes thanks u very much now to rack my brain for a while and figure out what u did :D many thanks mate :D

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Note - Remove a line

Do

Sleep(1000);want this to loop till $Afk is unchecked

Send("{1}")

GUICtrlRead($Afk) ; <<<--- This line is doing nothing to help the script, just remove it... 8)

Until GUICtrlRead($Afk) = $GUI_UNCHECKED;works if i click the check box it stops the script running

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Note - Remove a line

Do

Sleep(1000);want this to loop till $Afk is unchecked

Send("{1}")

GUICtrlRead($Afk) ; <<<--- This line is doing nothing to help the script, just remove it... 8)

Until GUICtrlRead($Afk) = $GUI_UNCHECKED;works if i click the check box it stops the script running

8)

thanks i was testing something before and hadn't bothered to remove it yet.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0