Jump to content

Brake loop


zabouth1
 Share

Recommended Posts

Hi i made a script that runs in a big loop but i am haveing problems i cant brake the loop :whistle:

#include <GUIConstants.au3>
#include <IE.au3>
Opt("TrayAutoPause",0)          ;0=no pause, 1=Pause

#Region ### START GUI section ### 
$Form1 = GUICreate("Hor or Not Clicker", 570, 186, 193, 115)
$LoginTXT = GUICtrlCreateInput("", 72, 32, 121, 21)
$PasswordTXT = GUICtrlCreateInput("", 72, 56, 121, 21)
$LoginBUT = GUICtrlCreateButton("Login", 200, 32, 75, 25, 0)
$Login = GUICtrlCreateLabel("Login", 16, 32, 30, 17)
$Password = GUICtrlCreateLabel("Password", 16, 56, 50, 17)
$Group1 = GUICtrlCreateGroup("Login", 8, 8, 273, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 288, 8, 273, 81)
$Combo1 = GUICtrlCreateCombo("", 368, 24, 153, 25)
GUICtrlSetData(-1,"2000|3000|4000|5000|6000|7000|8000|9000|10000", "item3")
$C = GUICtrlCreateLabel("ClickDelay", 296, 24, 54, 17)
$Button1 = GUICtrlCreateButton("Stop", 448, 48, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Go", 368, 48, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Info", 8, 96, 553, 81)
$Label1 = GUICtrlCreateLabel("ClickCount", 16, 112, 55, 17)
$Input1 = GUICtrlCreateInput("", 72, 112, 57, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
  $msg = GUIGetMsg()

  Select
  Case $msg = $Button2
$oIE = _IECreate ("www.texthere.com")
Sleep(10000)
WinActivate("page title", "")
$win = WinGetTitle('')
$delay = GUICtrlRead($Combo1)
;WinSetState($win,'',@SW_HIDE)
$i = 0
$count = 0
Do
    _IEImgClick ($oIE, "yes_button.gif", "src")
    Sleep($delay)
     $i = 0
     $count = $count + 1
 Until $msg = $Button1

    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
  EndSelect
WEnd

as you can see i am trying to make the go button start the loop and the stop button brake it. by useing the "Until $msg = $Button1"

but when the loop is running you gui will not let you click anything i have looking in the forums and looked at the help file but cannot find a way to do this if thre is a topic about this all reddy i could not find it i would be gratefully for any help thanks

Link to comment
Share on other sites

Hi i made a script that runs in a big loop but i am haveing problems i cant brake the loop :whistle:

#include <GUIConstants.au3>
#include <IE.au3>
Opt("TrayAutoPause",0)          ;0=no pause, 1=Pause

#Region ### START GUI section ### 
$Form1 = GUICreate("Hor or Not Clicker", 570, 186, 193, 115)
$LoginTXT = GUICtrlCreateInput("", 72, 32, 121, 21)
$PasswordTXT = GUICtrlCreateInput("", 72, 56, 121, 21)
$LoginBUT = GUICtrlCreateButton("Login", 200, 32, 75, 25, 0)
$Login = GUICtrlCreateLabel("Login", 16, 32, 30, 17)
$Password = GUICtrlCreateLabel("Password", 16, 56, 50, 17)
$Group1 = GUICtrlCreateGroup("Login", 8, 8, 273, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 288, 8, 273, 81)
$Combo1 = GUICtrlCreateCombo("", 368, 24, 153, 25)
GUICtrlSetData(-1,"2000|3000|4000|5000|6000|7000|8000|9000|10000", "item3")
$C = GUICtrlCreateLabel("ClickDelay", 296, 24, 54, 17)
$Button1 = GUICtrlCreateButton("Stop", 448, 48, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Go", 368, 48, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Info", 8, 96, 553, 81)
$Label1 = GUICtrlCreateLabel("ClickCount", 16, 112, 55, 17)
$Input1 = GUICtrlCreateInput("", 72, 112, 57, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
  $msg = GUIGetMsg()

  Select
  Case $msg = $Button2
$oIE = _IECreate ("www.texthere.com")
Sleep(10000)
WinActivate("page title", "")
$win = WinGetTitle('')
$delay = GUICtrlRead($Combo1)
;WinSetState($win,'',@SW_HIDE)
$i = 0
$count = 0
Do
    _IEImgClick ($oIE, "yes_button.gif", "src")
    Sleep($delay)
     $i = 0
     $count = $count + 1
 Until $msg = $Button1

    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
  EndSelect
WEnd oÝ÷ Ú)§¢Ö¯z¼ ¢ZºÚ"¶Ç+^­»­²Ì¨ºwvÚç$~ÆP´Ë j¢*"Ø^h¢¨ºwvÚ)§jëh×6Do
    _IEImgClick ($oIE, "yes_button.gif", "src")
    Sleep($delay)
     $i = 0
     $count = $count + 1
 $msg = GUIGetMsg()
 Until $msg = $Button1
Link to comment
Share on other sites

Just to make it a bit easer to read i have cut the code out and just left the loops in and added the update

#include <GUIConstants.au3>
#include <IE.au3>
Opt("TrayAutoPause",0)          ;0=no pause, 1=Pause


$Form1 = GUICreate("Form", 570, 186, 193, 115)
$LoginTXT = GUICtrlCreateInput("", 72, 32, 121, 21)
$PasswordTXT = GUICtrlCreateInput("", 72, 56, 121, 21)
$LoginBUT = GUICtrlCreateButton("Login", 200, 32, 75, 25, 0)
$Login = GUICtrlCreateLabel("Login", 16, 32, 30, 17)
$Password = GUICtrlCreateLabel("Password", 16, 56, 50, 17)
$Group1 = GUICtrlCreateGroup("Login", 8, 8, 273, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 288, 8, 273, 81)
$Combo1 = GUICtrlCreateCombo("", 368, 24, 153, 25)
GUICtrlSetData(-1,"2000|3000|4000|5000|6000|7000|8000|9000|10000", "item3")
$C = GUICtrlCreateLabel("ClickDelay", 296, 24, 54, 17)
$Stop = GUICtrlCreateButton("Stop", 448, 48, 75, 25, 0)
$Start = GUICtrlCreateButton("Go", 368, 48, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Info", 8, 96, 553, 81)
$Label1 = GUICtrlCreateLabel("ClickCount", 16, 112, 55, 17)
$Input1 = GUICtrlCreateInput("", 72, 112, 57, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)



While 1
  $msg = GUIGetMsg()

  Select
  Case $msg = $Start
;Do Some Stuff once 
Do
;Do some more stuff in a loop 
$msg = GUIGetMsg() ; Update the form variable
 Until $msg = $Stop ; Check if the stop button has been clicked if it has kill the loop.

    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

like i said b4 its as if when the loop is running its not reading what i click on the forn the exit button dose not work.

Link to comment
Share on other sites

Well this works for me

#include <GUIConstants.au3>
#include <IE.au3>
Opt("TrayAutoPause",0)          ;0=no pause, 1=Pause


$Form1 = GUICreate("Form", 570, 186, 193, 115)
$LoginTXT = GUICtrlCreateInput("", 72, 32, 121, 21)
$PasswordTXT = GUICtrlCreateInput("", 72, 56, 121, 21)
$LoginBUT = GUICtrlCreateButton("Login", 200, 32, 75, 25, 0)
$Login = GUICtrlCreateLabel("Login", 16, 32, 30, 17)
$Password = GUICtrlCreateLabel("Password", 16, 56, 50, 17)
$Group1 = GUICtrlCreateGroup("Login", 8, 8, 273, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Settings", 288, 8, 273, 81)
$Combo1 = GUICtrlCreateCombo("", 368, 24, 153, 25)
GUICtrlSetData(-1,"2000|3000|4000|5000|6000|7000|8000|9000|10000", "item3")
$C = GUICtrlCreateLabel("ClickDelay", 296, 24, 54, 17)
$Stop = GUICtrlCreateButton("Stop", 448, 48, 75, 25, 0)
$Start = GUICtrlCreateButton("Go", 368, 48, 75, 25, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Info", 8, 96, 553, 81)
$Label1 = GUICtrlCreateLabel("ClickCount", 16, 112, 55, 17)
$Input1 = GUICtrlCreateInput("", 72, 112, 57, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)



While 1
  $msg = GUIGetMsg()

  Select
    
    Case $msg = $Start
        ;Do Some Stuff once
        Do
            Sleep(100)
            ;Do some more stuff in a loop
            $msg = GUIGetMsg() ; Update the form variable
        Until $msg = $Stop ; Check if the stop button has been clicked if it has kill the loop.
        MsgBox(0,0,0) ;Loop is broked
    
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
  
  EndSelect

WEnd

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...