youknowwho4eva Posted July 7, 2008 Share Posted July 7, 2008 I'm trying to create a simple log in. I'm going to change the user name to a drop down when I get it working, but right now I can't get it to say which account its logging into, it errors at the msgbox. I would also like for when you type the password for it to replace the text with * if thats simple, if not then I'm not to worried about it. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> GUICreate("Log In", 500, 200) GUICtrlCreateLabel("User Name", 10, 10) $user = GUICtrlCreateInput("", 150, 10, 150, 20) GUICtrlCreateLabel("Password", 10, 30) $password = GUICtrlCreateInput("", 150, 30, 150, 20) $ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $acessbutton If guictrlread($user) = "Michael Williams" And GUICtrlRead($Password) = "password" Then MsgBox(0, "Logging in to power user account") Exit Else MsgBox(0, "Logging in to user account") Exit EndIf Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "Exit", "Closing, you will not be logged in") ExitLoop EndSelect WEnd Giggity Link to comment Share on other sites More sharing options...
someone Posted July 7, 2008 Share Posted July 7, 2008 Not sure if this is a typo in your reproducer but your msgbox has the wrong # of arguments... needs to be, MsgBox(0, "TITLE", "TEXT") While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Andreik Posted July 7, 2008 Share Posted July 7, 2008 I'm trying to create a simple log in. I'm going to change the user name to a drop down when I get it working, but right now I can't get it to say which account its logging into, it errors at the msgbox. I would also like for when you type the password for it to replace the text with * if thats simple, if not then I'm not to worried about it. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> GUICreate("Log In", 500, 200) GUICtrlCreateLabel("User Name", 10, 10) $user = GUICtrlCreateInput("", 150, 10, 150, 20) GUICtrlCreateLabel("Password", 10, 30) $password = GUICtrlCreateInput("", 150, 30, 150, 20) $ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $acessbutton If guictrlread($user) = "Michael Williams" And GUICtrlRead($Password) = "password" Then MsgBox(0, "Logging in to power user account") Exit Else MsgBox(0, "Logging in to user account") Exit EndIf Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "Exit", "Closing, you will not be logged in") ExitLoop EndSelect WEndLook at GuiControlCreateInput about $ES_PASSWORD style. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted July 7, 2008 Author Share Posted July 7, 2008 (edited) Thank you both much. If I weren't so new at this I'd smack myself in the head for the typo being the reason thats not working. And Andreik, thank you I did not see that before. Now I'm trying to get it to login when you hit the enter hey. I've looked up different methods but can't get them to work for me. Here is what I have now, any suggestions? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> #include <EditConstants.au3> GUICreate("Log In", 500, 200) GUICtrlCreateLabel("User Name", 10, 10) $user = GUICtrlCreateInput("", 150, 10, 150, 20) GUICtrlCreateLabel("Password", 10, 30) $password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD) $ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $acessbutton If GUICtrlRead($Password) = "password" Then MsgBox(0, "Access Granted", "Logging in to power user account") Exit Else MsgBox(0, "Access Granted", "Logging in to user account") Exit EndIf Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "Exit", "Closing, you will not be logged in") ExitLoop EndSelect WEnd of course after looking all day, I post this and 5 minutes later find my answer. Edited July 7, 2008 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
youknowwho4eva Posted July 7, 2008 Author Share Posted July 7, 2008 Alright one last thing I would like to add to this script, and I know this one is a leap above my abilities. So far you alls help has progressed me in leaps and bounds but this one makes my eye twinge trying to figure it out (too much cafine this morning) As you can see I added two acceptable passwords to get into the two different levels of the system. I also added an incorrect password message. I want it, if the password is incorrectly entered 3 times, to close the program. I've seen some stuff on how to have it add stuff like that, but like I said, my eye twitches while trying to wrap my brain around it right now. I think I'll also have it make an ini so I can find out who forgot their password or who is trying to access it uninvited. Here is what I have as of now, after this I can move on to my next step and find more questions for you all :-P expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> GUICreate("Log In", 500, 200) GUICtrlCreateLabel("User Name", 10, 10) $user = GUICtrlCreateInput("", 150, 10, 150, 20) GUICtrlCreateLabel("Password", 10, 30) $password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD) $ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60, "", $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $acessbutton If GUICtrlRead($Password) = "password" Then MsgBox(0, "Access Granted", "Logging in to power user account") Exit ElseIf GUICtrlRead($Password) = "user123" Then MsgBox(0, "Access Granted", "Logging in to user account") Exit Else MsgBox(0, "Access Denied", "Incorrect Passowrd") EndIf Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "Exit", "Closing, you will not be logged in") ExitLoop EndSelect WEnd Giggity Link to comment Share on other sites More sharing options...
someone Posted July 7, 2008 Share Posted July 7, 2008 (edited) If I have some more time I'll post an example, but its really just nesting If statements. Obviously this isn't correct, but should help; If GUICtrlRead($Password) = "password" Then $var = MsgBox(0, "Access Granted", "Logging in to power user account") If $var = "your password" ;whatever return value Then ; right Else ;wrong ;do msgbox again Edited July 7, 2008 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
yucatan Posted July 7, 2008 Share Posted July 7, 2008 Alright one last thing I would like to add to this script, and I know this one is a leap above my abilities. So far you alls help has progressed me in leaps and bounds but this one makes my eye twinge trying to figure it out (too much cafine this morning) As you can see I added two acceptable passwords to get into the two different levels of the system. I also added an incorrect password message. I want it, if the password is incorrectly entered 3 times, to close the program. I've seen some stuff on how to have it add stuff like that, but like I said, my eye twitches while trying to wrap my brain around it right now. I think I'll also have it make an ini so I can find out who forgot their password or who is trying to access it uninvited. Here is what I have as of now, after this I can move on to my next step and find more questions for you all :-P expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Include <WinAPI.au3> #include <EditConstants.au3> #include <ButtonConstants.au3> GUICreate("Log In", 500, 200) GUICtrlCreateLabel("User Name", 10, 10) $user = GUICtrlCreateInput("", 150, 10, 150, 20) GUICtrlCreateLabel("Password", 10, 30) $password = GUICtrlCreateInput("", 150, 30, 150, 20, $ES_PASSWORD) $ACESSBUTTON = GUICtrlCreateButton("Log In", 200, 60, 60, "", $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $acessbutton If GUICtrlRead($Password) = "password" Then MsgBox(0, "Access Granted", "Logging in to power user account") Exit ElseIf GUICtrlRead($Password) = "user123" Then MsgBox(0, "Access Granted", "Logging in to user account") Exit Else MsgBox(0, "Access Denied", "Incorrect Passowrd") EndIf Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "Exit", "Closing, you will not be logged in") ExitLoop EndSelect WEnd i have a nice TCP login if you want. Link to comment Share on other sites More sharing options...
youknowwho4eva Posted July 7, 2008 Author Share Posted July 7, 2008 Sure, Whats a TCP Login? And for "someone" I used $error = 0 then I used If GUICtrlRead($user) = "Michael Williams" Then If GUICtrlRead($Password) = "password" Then MsgBox(0, "Access Granted", "Logging in to power user account") #include <power.au3> Exit Else MsgBox(0, "Access Denied", "Incorrect Passowrd") >notice here, it adds one then if it equals 3 it closes the program :-D $error += 1 If $error = 3 Then MsgBox(0, "Failed Login", "Incorrect Password entered 3 times event being logged exiting program") ExitLoop EndIf EndIf EndIfWasnt as difficult as I first though/made it. Giggity Link to comment Share on other sites More sharing options...
BrettF Posted July 9, 2008 Share Posted July 9, 2008 Maybe this could help.http://www.autoitscript.com/forum/index.php?showtopic=54855Cheers,Brett 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...
matys Posted July 13, 2008 Share Posted July 13, 2008 Hi this is very very cool muttley But i want to get when i push button log in to get navigate to some link. Look that one i find on page to . When u type in window username and password and click log in u will be navigate to webpage and this username and password will be insert into login form. I copy some code from page look it: (pleas help me) This code will help u! #include <IE.au3> $sURL = "www.nexopia.com" $sUserName = "Username" $sPassword = "Password" _IEErrorHandlerRegister() $oIE = _IECreate($sURL) $oFrame = _IEFrameGetCollection($oIE, 1) _IELoadWait($oFrame) $oForm = _IEFormGetObjByName($oFrame, "login") $oUserName = _IEFormElementGetObjByName($oForm, "username") $oPassword = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oUserName, $sUserName) _IEFormElementSetValue($oPassword, $sPassword) 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