SuperFletch Posted December 14, 2007 Share Posted December 14, 2007 Hi Folks, I've had a good look through the GUI and General forums and I'm sure this will be explained in another post but I can't find it. If someone could point me to the right bit of the helpfile, an old dicussion board or post code that would be great. I use a GUI to get the end user to input a u/n & p/w for a particular application which are stored as variables for use later on in the program. I need to be sure they enter the correct details in the p/w box or my program will fail when it opens the app later. I basically want to make them enter the details of the password twice so that if they enter it incorrectly this is flagged with a message and asks them to try again. It's obviously possible, but I just can't think how to do it. TIA, Link to comment Share on other sites More sharing options...
therks Posted December 14, 2007 Share Posted December 14, 2007 I don't usually like to do this, but I'm bored so I wrote this up. expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Opt('GUIOnEventMode', 1) Global $sUsername, $sPassword Global $iPasswordStyle = BitOR($ES_LEFT, $ES_AUTOHSCROLL, $ES_PASSWORD) $gui = GUICreate('Login', 200, 100) GUISetOnEvent($GUI_EVENT_CLOSE, '_Handler') ; GUICtrlCreateLabel('Username:', 5, 5, 90, 20, $SS_CENTERIMAGE) $inUsername = GUICtrlCreateInput('', 105, 5, 90, 20) GUICtrlCreateLabel('Password:', 5, 25, 90, 20, $SS_CENTERIMAGE) $inPassword = GUICtrlCreateInput('', 105, 25, 90, 20, $iPasswordStyle) GUICtrlCreateLabel('Confirm Password:', 5, 45, 90, 20, $SS_CENTERIMAGE) $inPassConfirm = GUICtrlCreateInput('', 105, 45, 90, 20, $iPasswordStyle) $btContinue = GUICtrlCreateButton('Continue', 135, 70, 60, 25) GUICtrlSetOnEvent(-1, '_Handler') GUISetState() While 1 Sleep(1) WEnd Func _Handler() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $btContinue $sUsername = GUICtrlRead($inUsername) $sPassword = GUICtrlRead($inPassword) If $sPassword = GUICtrlRead($inPassConfirm) Then ; Good to go, close the GUI or whatever you want to do here. Else MsgBox(0,'', 'Passwords do not match.') Global $sUsername, $sPassword EndIf EndSwitch EndFunc My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
SuperFletch Posted December 14, 2007 Author Share Posted December 14, 2007 Cheers there, I'll try that this evening... Link to comment Share on other sites More sharing options...
corey822 Posted December 16, 2007 Share Posted December 16, 2007 is there anyway to match it to a file stored somewhere else ? or to any file? C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake 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