Sign in to follow this  
Followers 0

gui input box

30 posts in this topic

Posted

how do i create a gui with 2 input boxes one with username one with password and a button Login.

??

Share this post


Link to post
Share on other sites



Posted (edited)

how do i create a gui with 2 input boxes one with username one with password and a button Login.

??

$GUI = GUICreate("Login",100,120,-1,-1)
$USER = GUICtrlCreateInput("Username",10,5,90,20)
$PASS = GUICtrlCreateInput("",10,30,90,20,0x0020)
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)

You can add some label controls with username and password.

Edited by Andreik

Share this post


Link to post
Share on other sites

Posted

$GUI = GUICreate("Login",100,120,-1,-1)
$USER = GUICtrlCreateInput("Username",10,5,90,20)
$PASS = GUICtrlCreateInput("",10,30,90,20,0x0020)
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)

You can add some label controls with username and password.

hmm.. when i run the code i get it and it is gone 1 sec later how is that posseble ?

Share this post


Link to post
Share on other sites

Posted

hmm.. when i run the code i get it and it is gone 1 sec later how is that posseble ?

what i do wrong that every time i start he is gone ?????????

Share this post


Link to post
Share on other sites

Posted

what i do wrong that every time i start he is gone ?????????

????

Share this post


Link to post
Share on other sites

Posted

Would you please stop spamming they are not bots or something, I would awnser if I knew something about GUI... But just stop spamming and wait for a reply.

Share this post


Link to post
Share on other sites

Posted

$GUI = GUICreate("Login",100,120,-1,-1)
$USER = GUICtrlCreateInput("Username",10,5,90,20)
$PASS = GUICtrlCreateInput("",10,30,90,20,0x0020)
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)
While 1
    $MSG = GUIGetMsg()
    If $MSG = $LOGIN Then
        ...
        Verify Login Sesion
        ...
    EndIf
WEnd

Share this post


Link to post
Share on other sites

Posted

$GUI = GUICreate("Login",100,120,-1,-1)
$USER = GUICtrlCreateInput("Username",10,5,90,20)
$PASS = GUICtrlCreateInput("",10,30,90,20,0x0020)
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)
While 1
    $MSG = GUIGetMsg()
    If $MSG = $LOGIN Then
        ...
        Verify Login Sesion
        ...
    EndIf
WEnd
#include <GUIConstants.au3>

$widthCell=70

GUICreate(" My GUI input acceptfile", 220,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES

GUICtrlCreateLabel ("Username: ", 5, 10, $widthCell)

GUICtrlCreateLabel ("Password: ", 5, 40, $widthCell)

$username = GUICtrlCreateInput ( "", 70, 5, 100, 20)

$password = GUICtrlCreateInput ("", 70, 35, 100, 20) ; will not accept drag&drop files

$btn = GUICtrlCreateButton ("Ok", 100, 75, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

exitloop

EndSelect

Wend

i have made a GUI i wanne use but how do i set what to do if i klik on the button where i can set the code that he runs then when i click the button ???

Share this post


Link to post
Share on other sites

Posted

After

Case $msg = $btn

But you should already know that since you exit the script when the button is clicked?

Share this post


Link to post
Share on other sites

Posted (edited)

$GUI = GUICreate("Login",100,100,-1,-1,0x16C80000,0x00000181)
$USER = GUICtrlCreateInput("",5,5,90,20,0x0001)
$PASS = GUICtrlCreateInput("",5,30,90,20,BitOR(0x0020,0x0001))
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)
While 1
    $MSG = GUIGetMsg()
    Switch $MSG
    Case $LOGIN
        If VerifyLogin(GUICtrlRead($USER),GUICtrlRead($PASS)) = 1 Then
            GUIDelete($GUI)
            MsgBox(-1,"Login Session","SUCCESSFUL LOGIN")
        Else
            MsgBox(-1,"Login Session","INCORRECT USERNAME OR PASSWORD")
        EndIf
    Case -3
        Exit
    EndSwitch
WEnd

Func VerifyLogin($USER,$PASS)
    If $USER = "yucatan" And $PASS = "autoit" Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

After this line

MsgBox(-1,"Login Session","SUCCESSFUL LOGIN")
you can add your code. If you want to choose the running code you can add a new GUI with options and that you can select code. Edited by Andreik

Share this post


Link to post
Share on other sites

Posted

$GUI = GUICreate("Login",100,100,-1,-1,0x16C80000,0x00000181)
$USER = GUICtrlCreateInput("",5,5,90,20,0x0001)
$PASS = GUICtrlCreateInput("",5,30,90,20,BitOR(0x0020,0x0001))
$LOGIN = GUICtrlCreateButton("LOGIN",20,60,60,20)
GUISetState(@SW_SHOW,$GUI)
While 1
    $MSG = GUIGetMsg()
    Switch $MSG
    Case $LOGIN
        If VerifyLogin(GUICtrlRead($USER),GUICtrlRead($PASS)) = 1 Then
            GUIDelete($GUI)
            MsgBox(-1,"Login Session","SUCCESSFUL LOGIN")
        Else
            MsgBox(-1,"Login Session","INCORRECT USERNAME OR PASSWORD")
        EndIf
    Case -3
        Exit
    EndSwitch
WEnd

Func VerifyLogin($USER,$PASS)
    If $USER = "yucatan" And $PASS = "autoit" Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

After this line

MsgBox(-1,"Login Session","SUCCESSFUL LOGIN")
you can add your code. If you want to choose the running code you can add a new GUI with options and that you can select code.

$username = GUICtrlCreateInput ( "", 70, 5, 100, 20)

$password = GUICtrlCreateInput ("", 70, 35, 100, 20)

how i can detect what is typed here how do i put it in a $var

when i do

MsgBox(4096, "Test", $password, 10)

then then i get 5 or 6 or something like that but not the text or figures that is typed there

Share this post


Link to post
Share on other sites

Posted

$username = GUICtrlCreateInput ( "", 70, 5, 100, 20)

$password = GUICtrlCreateInput ("", 70, 35, 100, 20)

how i can detect what is typed here how do i put it in a $var

when i do

MsgBox(4096, "Test", $password, 10)

then then i get 5 or 6 or something like that but not the text or figures that is typed there

$USER = GuiCtrlRead($username)
$PASS = GuiCtrlRead($password)

Share this post


Link to post
Share on other sites

Posted (edited)

how do i make a hotkey that when i hit ENTER he do the same as when i klik Login. on the button ?

Edited by yucatan

Share this post


Link to post
Share on other sites

Posted

how do i make a hotkey that when i hit ENTER he do the same as when i klik Login. on the button ?

Look in help about HotKeySet and ControlClick().

Share this post


Link to post
Share on other sites

Posted

Look in help about HotKeySet and ControlClick().

#include <GUIConstants.au3>

HotKeySet("{enter}", "button")

TCPStartup()

$widthCell=70

GUICreate(" My GUI input acceptfile", 220,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILES

GUICtrlCreateLabel ("Username: ", 5, 10, $widthCell)

GUICtrlCreateLabel ("Password: ", 5, 40, $widthCell)

$username = GUICtrlCreateInput ( "", 70, 5, 100, 20)

$password = GUICtrlCreateInput ("", 70, 35, 100, 20) ; will not accept drag&drop files

$btn = GUICtrlCreateButton ("Ok", 100, 75, 60, 20)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

Select

Case $msg = $btn

$USER = GuiCtrlRead($username)

$PASS = GuiCtrlRead($password)

if $USER="" then MsgBox(4096, "Error", "Pleas Fill in a username.")

if $Pass="" then MsgBox(4096, "Error", "Pleas Fill in a username.")

if $user>"" and $pass>"" then

$socket=TCPConnect("127.0.0.1",2111)

If @error Then

MsgBox(16,"Error","Couldn't connect to server")

Exit

EndIf

TCPSend($socket,$USER&"|"&$pass)

Do

sleep(10)

$temp=TCPRecv($socket,256)

Until $temp<>""

If $temp="Connected" Then

MsgBox(0,"Success","You connected with the right username and pass smile.gif")

Else

MsgBox(16,"Success","Wrong username / password sad.gif")

EndIf

EndIf

EndSelect

Wend

Func button()

ControlClick("", "", "Button1")

EndFunc

this is my code

but when i enter a username

and i hit enter

i get error pleas fill in a password

but when i push enter then

the Error. box dont go away the error box with Pleas fill in a password.

how i can fix that if i push enter then it go away.?

Share this post


Link to post
Share on other sites

Posted

can somebody anser my question ?

Share this post


Link to post
Share on other sites

Posted

GuiCtrlSetState ($btn, $GUI_DEFBUTTON)

muttley

Share this post


Link to post
Share on other sites

Posted

GuiCtrlSetState ($btn, $GUI_DEFBUTTON)

muttley

hmm sorry i dont understand what does that code do

when my login compleet how i can close the gui then because i dont need the login anymore when you are already logged in ?

Share this post


Link to post
Share on other sites

Posted

hmm sorry i dont understand what does that code do

when my login compleet how i can close the gui then because i dont need the login anymore when you are already logged in ?

how to use GUICtrlCreateInput as Password Input so that when i typ i see **** ????

Share this post


Link to post
Share on other sites

Posted (edited)

how to use GUICtrlCreateInput as Password Input so that when i typ i see **** ????

Use $ES_PASSWORD style. Edited by Andreik

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

  • Recently Browsing   0 members

    No registered users viewing this page.