yucatan Posted July 3, 2008 Share Posted July 3, 2008 how do i create a gui with 2 input boxes one with username one with password and a button Login. ?? Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 (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 July 3, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 $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 ? Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 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 ????????? Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 what i do wrong that every time i start he is gone ????????????? Link to comment Share on other sites More sharing options...
Resurrection Posted July 3, 2008 Share Posted July 3, 2008 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. Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 $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. Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 $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 ??? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 3, 2008 Share Posted July 3, 2008 After Case $msg = $btn But you should already know that since you exit the script when the button is clicked? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 (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 July 3, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 $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 Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 $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. Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 (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 July 3, 2008 by yucatan Link to comment Share on other sites More sharing options...
Andreik Posted July 3, 2008 Share Posted July 3, 2008 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. Link to comment Share on other sites More sharing options...
yucatan Posted July 3, 2008 Author Share Posted July 3, 2008 Look in help about HotKeySet and ControlClick().#include <GUIConstants.au3>HotKeySet("{enter}", "button")TCPStartup()$widthCell=70GUICreate(" My GUI input acceptfile", 220,120, @DesktopWidth/2-160, @DesktopHeight/2-45, -1, 0x00000018); WS_EX_ACCEPTFILESGUICtrlCreateLabel ("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 = 0While $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 EndSelectWendFunc button()ControlClick("", "", "Button1")EndFuncthis is my code but when i enter a usernameand i hit enteri get error pleas fill in a passwordbut 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.? Link to comment Share on other sites More sharing options...
yucatan Posted July 4, 2008 Author Share Posted July 4, 2008 can somebody anser my question ? Link to comment Share on other sites More sharing options...
BrettF Posted July 4, 2008 Share Posted July 4, 2008 GuiCtrlSetState ($btn, $GUI_DEFBUTTON) muttley Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
yucatan Posted July 4, 2008 Author Share Posted July 4, 2008 GuiCtrlSetState ($btn, $GUI_DEFBUTTON)muttleyhmm 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 ? Link to comment Share on other sites More sharing options...
yucatan Posted July 5, 2008 Author Share Posted July 5, 2008 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 **** ???? Link to comment Share on other sites More sharing options...
Andreik Posted July 5, 2008 Share Posted July 5, 2008 (edited) how to use GUICtrlCreateInput as Password Input so that when i typ i see **** ????Use $ES_PASSWORD style. Edited July 5, 2008 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now