Sign in to follow this  
Followers 0

gui input box

30 posts in this topic

Posted · Report post

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) · Report post

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 · Report post

$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 · Report post

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 · Report post

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

????

Share this post


Link to post
Share on other sites

Posted · Report post

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 · Report post

$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 · Report post

$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 · Report post

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) · Report post

$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 · Report post

$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 · Report post

$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) · Report post

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 · Report post

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 · Report post

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 · Report post

can somebody anser my question ?

Share this post


Link to post
Share on other sites

Posted · Report post

GuiCtrlSetState ($btn, $GUI_DEFBUTTON)

muttley

Share this post


Link to post
Share on other sites

Posted · Report post

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 · Report post

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) · Report post

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

Posted (edited) · Report post

Use $ES_PASSWORD style.

hi how i can close my gui ? but the script needs to go on if want to do if $var = "something" then close gui

because when the login is compleet the gui needs to close and do something else

if the login fails the gui needs to stay te retry the login

how do i fix that ?

i have another problem

when the gui runs and a msgbox appiers then the box is behind the gui and not in front of the gui how i can fix that ?

Edited by yucatan

Share this post


Link to post
Share on other sites

Posted · Report post

because when the login is compleet the gui needs to close and do something else

if the login fails the gui needs to stay te retry the login

how do i fix that ?

Use GUICtrlDelete ( controlID ) to delete old GUI and after you can create another GUI or run some code without GUI.

Share this post


Link to post
Share on other sites

Posted · Report post

when the gui runs and a msgbox appiers then the box is behind the gui and not in front of the gui how i can fix that ?

Use 262144 for MsgBox flag.

MsgBox has top-most attribute set

MsgBox(262144,"TEST","MESSAGE")

Share this post


Link to post
Share on other sites

Posted · Report post

Use 262144 for MsgBox flag.

MsgBox has top-most attribute set

MsgBox(262144,"TEST","MESSAGE")

k the msgbox works thx

but i dont wanne delete the controls of the gui i wanne kill the whole gui window. just close it

in the GUI if i push Enter then he kliks Login. but when the msgbox comes up i want that if i push enter that he close the msbbox then

he need to close this msgbox then

MsgBox(262144,"TEST","MESSAGE")

i use this now

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

Func button()

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

EndFunc

Share this post


Link to post
Share on other sites

Posted · Report post

k the msgbox works thx

but i dont wanne delete the controls of the gui i wanne kill the whole gui window. just close it

in the GUI if i push Enter then he kliks Login. but when the msgbox comes up i want that if i push enter that he close the msbbox then

he need to close this msgbox then

MsgBox(262144,"TEST","MESSAGE")

i use this now

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

Func button()

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

EndFunc

Sorry GUIDelete() to delete whole GUI.

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.