Necromorph Posted March 4, 2010 Share Posted March 4, 2010 ok i have this code, but it isn't working, #INCLUDE <GUIConstantsEx.au3> GUICREATE("redLabel password vault", 250, 225) GUICTRLCREATELABEL("username", 25, 25) $tUsername=GUICTRLCREATEINPUT("", 25, 50, 200) GUICTRLCREATELABEL("password", 25, 100) $tPassword=GUICTRLCREATEINPUT("", 25, 125, 200) $tCancel=GUICTRLCREATEBUTTON("cancel", 75, 175, 75) $tStart=GUICTRLCREATEBUTTON("login", 150, 175, 75) GUISETSTATE() GUICTRLSETSTATE($tStart, $GUI_DEFBUTTON) WHILE 1 $msg=GUIGETMSG() IF $msg=$GUI_EVENT_CLOSE THEN EXIT ELSEIF $msg=$tCancel THEN EXIT ELSEIF $msg=$tStart THEN IF NOT GUICTRLREAD($tUsername="test" AND $tPassword="test") THEN MSGBOX(0, "redLabel password vault", "invalid username/password") ELSE MSGBOX(0, "redLabel password vault", "login sucsessful") GUISETSTATE(@SW_HIDE) EXITLOOP ENDIF ENDIF WEND but it is always stuck even if the right username and password are entered. but if i put an exitloop after the "IF NOT" then after the msgbox, it ends, which i also don't want. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 4, 2010 Share Posted March 4, 2010 Try this. Change IF NOT GUICTRLREAD($tUsername="test" AND $tPassword="test") THEN to IF NOT GUICTRLREAD($tUsername) = "test" AND GUICTRLREAD($tPassword) = "test") THEN - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 (edited) #INCLUDE <GUIConstantsEx.au3> GUICREATE("redLabel password vault", 250, 225) GUICTRLCREATELABEL("username", 25, 25) $tUsername=GUICTRLCREATEINPUT("", 25, 50, 200) GUICTRLCREATELABEL("password", 25, 100) $tPassword=GUICTRLCREATEINPUT("", 25, 125, 200) $tCancel=GUICTRLCREATEBUTTON("cancel", 75, 175, 75) $tStart=GUICTRLCREATEBUTTON("login", 150, 175, 75) GUISETSTATE() GUICTRLSETSTATE($tStart, $GUI_DEFBUTTON) WHILE 1 $msg=GUIGETMSG() IF $msg=$GUI_EVENT_CLOSE THEN EXIT ELSEIF $msg=$tCancel THEN EXIT ELSEIF $msg=$tStart THEN IF NOT GUICTRLREAD($tUsername="test" AND $tPassword="test") THEN ;<- I think the problem is here MSGBOX(0, "redLabel password vault", "invalid username/password") ELSE MSGBOX(0, "redLabel password vault", "login sucsessful") GUISETSTATE(@SW_HIDE) EXITLOOP ENDIF ENDIF WENDI think it should read:IF GUICTRLREAD($tUsername) <> "test" AND GUICTRLREAD($tPassword) <> "test" THENDisclaimer: I can't test this at the moment, but it looks like that would create the problem you are having. This is what I think is happening:Original Code:1: IF NOT GUICTRLREAD($tUsername="test" AND $tPassword="test") THENEvaluation of inner statement:2: IF NOT GUICTRLREAD(False AND False) THENEvaluation of (False AND False):3: IF NOT GUICTRLREAD(False) THENGUICTRLREAD returns False, because 'False' isn't a valid control:4: IF NOT False THENThis is why it always gets stuck:5: IF True ThenEdited for readability Edited March 4, 2010 by Fulano #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 Try this. Change IF NOT GUICTRLREAD($tUsername="test" AND $tPassword="test") THEN to IF NOT GUICTRLREAD($tUsername) = "test" AND GUICTRLREAD($tPassword) = "test") THENAn excess of parenthesis is almost never a bad thing.AutoIt will read this as IF (NOT GUICTRLREAD($tUsername) = "test") AND GUICTRLREAD($tPassword) = "test") THEN, so it will fail on the correct username.Side note: AutoIt scripts are really, really insecure, so definitely hash those passwords and usernames so you can't pull them out of the script #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 4, 2010 Share Posted March 4, 2010 I think it should read: IF GUICTRLREAD($tUsername) <> "test" AND GUICTRLREAD($tPassword) <> "test" THEN Yup. I was again not thinking about what I was typing.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 ::Shrugs:: It happens to the best ... and me as well #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
Necromorph Posted March 4, 2010 Author Share Posted March 4, 2010 IF NOT (GUICTRLREAD($tUsername)=="test" AND GUICTRLREAD($tPassword)=="test") THENthis works perfect, and it makes it case sensitive. so thanks to both of your for your help!! Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 Np, glad it works #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
spudw2k Posted March 4, 2010 Share Posted March 4, 2010 quick lesson in security. DO NOT hardcode username or passwords in cleartext. Always use an encryption scheme (I strongly recommend a one-way hash) to protect authentication credentials. Now that you have a working form, do yourself a favor an research how to implement an encryption method rather than putting the user and pass in the code. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Fulano Posted March 4, 2010 Share Posted March 4, 2010 quick lesson in security. DO NOT hardcode username or passwords in cleartext. Always use an encryption scheme (I strongly recommend a one-way hash) to protect authentication credentials. Now that you have a working form, do yourself a favor an research how to implement an encryption method rather than putting the user and pass in the code.BUMP! #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! 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