Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

gui input box


  • Please log in to reply
29 replies to this topic

#1 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 12:04 PM

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


??







#2 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 03 July 2008 - 12:13 PM

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, 03 July 2008 - 12:15 PM.

When the words fail... music speaks

#3 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 12:56 PM

$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 ?

#4 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 01:17 PM

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

#5 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 03:36 PM

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



????

#6 Resurrection

Resurrection

    Seeker

  • Active Members
  • 10 posts

Posted 03 July 2008 - 03:42 PM

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.

#7 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 03 July 2008 - 04:04 PM

$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

When the words fail... music speaks

#8 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 04:13 PM

$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 ???

#9 AdmiralClaws

AdmiralClaws

    Where is the fish?

  • Active Members
  • PipPipPipPipPipPip
  • 4,669 posts

Posted 03 July 2008 - 04:16 PM

After
Case $msg = $btn

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

#10 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 03 July 2008 - 04:25 PM

Plain Text         
$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, 03 July 2008 - 04:26 PM.

When the words fail... music speaks

#11 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 04:32 PM

Plain Text         
$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

#12 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 03 July 2008 - 04:36 PM

$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)

When the words fail... music speaks

#13 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 04:48 PM

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, 03 July 2008 - 05:05 PM.


#14 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 03 July 2008 - 05:16 PM

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().
When the words fail... music speaks

#15 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 03 July 2008 - 05:36 PM

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

#16 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 04 July 2008 - 11:39 AM

can somebody anser my question ?

#17 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 04 July 2008 - 11:45 AM

GuiCtrlSetState ($btn, $GUI_DEFBUTTON)

:muttley:

#18 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 04 July 2008 - 12:19 PM

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 ?

#19 yucatan

yucatan

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 593 posts

Posted 05 July 2008 - 09:53 AM

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 **** ????

#20 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,590 posts

Posted 05 July 2008 - 09:57 AM

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

Use $ES_PASSWORD style.

Edited by Andreik, 05 July 2008 - 09:58 AM.

When the words fail... music speaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users