Jump to content

Simple Question


anyday
 Share

Recommended Posts

got a real simple ques.

i have a button on my main form called Set login which brings up another password dialog box. what do i set $msg = $ok to make the script close that dialog but leave the main form open?

#include <ie.au3>
#include <GUIConstants.au3>
; == GUI generated with Koda ==
$newzbin = GUICreate("Newzbin Search FrontEnd", 754, 471, 186, 141)
$setlogin = GUICtrlCreateButton("Set Login", 576, 432, 75, 25, 0)
$Button1 = GUICtrlCreateButton("Exit", 668, 432, 75, 25, 0)
GUICtrlCreateLabel("Search:", 8, 12, 66, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$search = GUICtrlCreateInput("", 4, 44, 293, 21)
GUICtrlCreateLabel("Category:", 340, 12, 85, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$category = GUICtrlCreateCombo("", 336, 44, 221, 21)
GUICtrlCreateLabel("Results:", 8, 84, 60, 23)
GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0xFF0000)
$searchsubmit = GUICtrlCreateButton("Submit", 600, 44, 75, 25, 0)
$ListView1 = GUICtrlCreateListView("", 4, 116, 554, 342)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $searchsubmit
        $oIE = _IECreate(0)
        _IENavigate($oIE, "http://www.newzbin.com")
        $title = _IEBodyReadHTML($oIE)
        Run ("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        send ($title)
    Case $msg = $setlogin
    ; == GUI generated with Koda ==
        $newzbinlogin = GUICreate("Newzbin Login", 257, 179, 365, 687)
        GUISetIcon("D:\008.ico")
        GUICtrlCreateLabel("Enter Password:", 8, 72, 81, 17, $WS_GROUP)
        $nzbpass = GUICtrlCreateInput("", 8, 96, 233, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL,$WS_GROUP))
        $ok = GUICtrlCreateButton("&Ok", 167, 144, 75, 25)
        GUICtrlCreateLabel("Enter Login:", 8, 8, 61, 17, $WS_GROUP)
        $nzblogin = GUICtrlCreateInput("", 8, 36, 233, 21, BitOR($ES_AUTOHSCROLL,$WS_GROUP))
        GUISetState(@SW_SHOW)
            While 1
                $msg = GuiGetMsg()
                Select
                    Case $msg = $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $msg = $ok
                        ExitLoop
                    Case Else
                    ;;;;;;;
                EndSelect
            WEnd


    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

maybe something like:

#include <ie.au3>
#include <GUIConstants.au3>
; == GUI generated with Koda ==
$newzbin = GUICreate("Newzbin Search FrontEnd", 754, 471, 186, 141)
$setlogin = GUICtrlCreateButton("Set Login", 576, 432, 75, 25, 0)
$Button1 = GUICtrlCreateButton("Exit", 668, 432, 75, 25, 0)
GUICtrlCreateLabel("Search:", 8, 12, 66, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$search = GUICtrlCreateInput("", 4, 44, 293, 21)
GUICtrlCreateLabel("Category:", 340, 12, 85, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$category = GUICtrlCreateCombo("", 336, 44, 221, 21)
GUICtrlCreateLabel("Results:", 8, 84, 60, 23)
GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0xFF0000)
$searchsubmit = GUICtrlCreateButton("Submit", 600, 44, 75, 25, 0)
$ListView1 = GUICtrlCreateListView("", 4, 116, 554, 342)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $searchsubmit
            $oIE = _IECreate (0)
            _IENavigate ($oIE, "http://www.newzbin.com")
            $title = _IEBodyReadHTML ($oIE)
            Run("notepad.exe")
            WinWaitActive("Untitled - Notepad")
            Send($title)
        Case $msg = $setlogin
        ; == GUI generated with Koda ==
            GUISetState(@SW_DISABLE,$newzbin)
            $newzbinlogin = GUICreate("Newzbin Login", 257, 179)
            GUISetIcon("D:\008.ico")
            GUICtrlCreateLabel("Enter Password:", 8, 72, 81, 17, $WS_GROUP)
            $nzbpass = GUICtrlCreateInput("", 8, 96, 233, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL, $WS_GROUP))
            $ok = GUICtrlCreateButton("&Ok", 167, 144, 75, 25)
            GUICtrlCreateLabel("Enter Login:", 8, 8, 61, 17, $WS_GROUP)
            $nzblogin = GUICtrlCreateInput("", 8, 36, 233, 21, BitOR($ES_AUTOHSCROLL, $WS_GROUP))
            GUISetState(@SW_SHOW)
            While 1
                $msg2 = GUIGetMsg()
                Select
                    Case $msg2 = $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $msg2 = $ok
                        $pwd = GUICtrlRead($nzbpass)
                        $logon = GUICtrlRead($nzblogin)
                        ExitLoop
                    Case Else
                    ;;;;;;;
                EndSelect
            WEnd
            GUISetState(@SW_ENABLE,$newzbin)
            GUIDelete($newzbinlogin)
            MsgBox(0,"test","Logon: " & $logon & @LF & "Password: " & $pwd)
            
        Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • Moderators

Might work like this easier:

#include <ie.au3>
#include <GUIConstants.au3>
; == GUI generated with Koda ==
$newzbin = GUICreate("Newzbin Search FrontEnd", 754, 471, 186, 141)
$setlogin = GUICtrlCreateButton("Set Login", 576, 432, 75, 25, 0)
$Button1 = GUICtrlCreateButton("Exit", 668, 432, 75, 25, 0)
GUICtrlCreateLabel("Search:", 8, 12, 66, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$search = GUICtrlCreateInput("", 4, 44, 293, 21)
GUICtrlCreateLabel("Category:", 340, 12, 85, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
$category = GUICtrlCreateCombo("", 336, 44, 221, 21)
GUICtrlCreateLabel("Results:", 8, 84, 60, 23)
GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0xFF0000)
$searchsubmit = GUICtrlCreateButton("Submit", 600, 44, 75, 25, 0)
$ListView1 = GUICtrlCreateListView("", 4, 116, 554, 342)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $searchsubmit
        $oIE = _IECreate(0)
        _IENavigate($oIE, "http://www.newzbin.com")
        $title = _IEBodyReadHTML($oIE)
        Run ("notepad.exe")
        WinWaitActive("Untitled - Notepad")
        send ($title)
    Case $msg = $setlogin
        GUISetState(@SW_HIDE, $newzbin)
        GUISetState($GUI_DISABLE, $newzbin)
        LogInGUI()
        GUISetState($GUI_ENABLE, $newzbin)
        GUISetState(@SW_SHOW, $newzbin)
    EndSelect
WEnd
Exit

Func LogInGUI()
    $newzbinlogin = GUICreate("Newzbin Login", 257, 179, 365, 687)
    GUISetIcon("D:\008.ico")
    GUICtrlCreateLabel("Enter Password:", 8, 72, 81, 17, $WS_GROUP)
    $nzbpass = GUICtrlCreateInput("", 8, 96, 233, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL,$WS_GROUP))
    $ok = GUICtrlCreateButton("&Ok", 167, 144, 75, 25)
    GUICtrlCreateLabel("Enter Login:", 8, 8, 61, 17, $WS_GROUP)
    $nzblogin = GUICtrlCreateInput("", 8, 36, 233, 21, BitOR($ES_AUTOHSCROLL,$WS_GROUP))
    GUISetState(@SW_SHOW, $newzbinlogin)
    While 1
        $msg2 = GuiGetMsg()
        Select
            Case $msg2 = $GUI_EVENT_CLOSE
                GUIDelete($newzbinlogin)
                ExitLoop
            Case $msg2 = $ok
                ExitLoop
        EndSelect
    WEnd
EndFunc
Or just use Gary's :), I'm going to stop responding in here!! Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...