Sublime Posted April 21, 2006 Share Posted April 21, 2006 (edited) Im not really sure if im going about this the right way or not. Im just starting with autoit and im still very unfimiliar with using functions and all. I do have some knowledge as how things were done as in Autoit v2 which i just recently switchd from it and it appears many things have been changed. Out with the old and in the with the new as they say but im not buying it so far. Well what I need help with is validating my password I cant figure it out. Its driving me nuts. My apologies if this is in the wrong section. I've search all over the forums and can't find anything to beat this into my head ive seen lots of people giving the answer to a person but an explanation of what has been done and how it works would do me more good than just doing it for me. As they say dont give a man a fish teach him how to fish. But what ever. Apologies if this is a bit lenghly. Here is my code so far. Take into account I am clueless if any of this is unecesary or incorrect. #include <GuiConstants.au3> $passwd = InputBox("Security Check", "Enter your password.", "", "*") $maingui = GuiCreate("Testing GUI", 200, 400) GuiCtrlCreateMenu("&File") GuiCtrlCreateMenu("&Edit") $date = GuiCtrlCreateDate("", 5, 5, 90, 20, $DTS_SHORTDATEFORMAT) $time = GuiCtrlCreateDate("", 105, 5, 90, 20, $DTS_TIMEFORMAT) $chkbox1 = GuiCtrlCreateCheckbox("Checkbox", 5, 40, 80, 20) $chkbox2 = GuiCtrlCreateCheckbox("Checkbox", 5, 80, 80, 20) $chkbox3 = GuiCtrlCreateCheckbox("Checkbox", 5, 120, 80, 20) $chkbox4 = GuiCtrlCreateCheckbox("Checkbox", 5, 160, 80, 20) $chkbox5 = GuiCtrlCreateCheckbox("Checkbox", 5, 200, 80, 20) $chkbox6 = GuiCtrlCreateCheckbox("Checkbox", 5, 240, 80, 20) $chkbox7 = GuiCtrlCreateCheckbox("Checkbox", 5, 280, 80, 20) $chkbox = GuiCtrlSetState(0, $GUI_CHECKED) $submit = GuiCtrlCreateButton("Submit", 0, 330, 100, 30) $cancel = GuiCtrlCreateButton("Cancel", 101, 330, 100, 30) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Edited April 21, 2006 by Sublime Link to comment Share on other sites More sharing options...
Paulie Posted April 21, 2006 Share Posted April 21, 2006 Welcome to the forum(I'm totally taking a veterans job) I'd do a search for other topics, because im pretty sure i've seen password questions in the forums Just search "password" or something like that, you're bound to get a few hits Link to comment Share on other sites More sharing options...
Sublime Posted April 21, 2006 Author Share Posted April 21, 2006 I have many a time. I spent 2 hrs looking at the different topics on it and it made as much sense as it would speaking greak to me. I dont speak greak at all by the way. I understand it a little but for the most part its completely foreign. Link to comment Share on other sites More sharing options...
cdkid Posted April 21, 2006 Share Posted April 21, 2006 Umm If $passwd = "A PassWord" Then ;Code to do if it's right Else ;code to do if it's wrong EndIf Sorry, I don't understand the question... all you said was "validate the password" Against what? ~cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Sublime Posted April 21, 2006 Author Share Posted April 21, 2006 (edited) Well c ive tried that and it completly blows right past it and opens the gui. See im trying to create a gui that will run a series of customized instalion of drivers and programs and I dont want just anyone to be able to initialize these so im guna program it into the gui but first off i want to program it so its password protected before i even start so no one can run it cause i do have 2 little brothers who like to click crap and this script could potentially screw up my comp once i start. Now ive tried what you put above but it completely ignores it if the pass is wrong and opens the gui anyway. What I want it to do is ask for the password lets just say in this instance its password than if lets say you typed 123 itd come up and tell you wrong password than loop untill you get it right than continue. Sry if i was a bit vague b4 Edited April 21, 2006 by Sublime Link to comment Share on other sites More sharing options...
Paulie Posted April 21, 2006 Share Posted April 21, 2006 (edited) Here try sumthing like this (using your origanal code with CDkid's built in) #include <GuiConstants.au3> $passwd = InputBox("Security Check", "Enter your password.", "", "*") If $passwd = "Password" Then $answer1 = MsgBox(0, "Accepted", "Access Granted Correct password") If $answer1 = 1 then $maingui = GuiCreate("Testing GUI", 200, 400) GuiCtrlCreateMenu("&File") GuiCtrlCreateMenu("&Edit") $date = GuiCtrlCreateDate("", 5, 5, 90, 20, $DTS_SHORTDATEFORMAT) $time = GuiCtrlCreateDate("", 105, 5, 90, 20, $DTS_TIMEFORMAT) $chkbox1 = GuiCtrlCreateCheckbox("Checkbox", 5, 40, 80, 20) $chkbox2 = GuiCtrlCreateCheckbox("Checkbox", 5, 80, 80, 20) $chkbox3 = GuiCtrlCreateCheckbox("Checkbox", 5, 120, 80, 20) $chkbox4 = GuiCtrlCreateCheckbox("Checkbox", 5, 160, 80, 20) $chkbox5 = GuiCtrlCreateCheckbox("Checkbox", 5, 200, 80, 20) $chkbox6 = GuiCtrlCreateCheckbox("Checkbox", 5, 240, 80, 20) $chkbox7 = GuiCtrlCreateCheckbox("Checkbox", 5, 280, 80, 20) $chkbox = GuiCtrlSetState(0, $GUI_CHECKED) $submit = GuiCtrlCreateButton("Submit", 0, 330, 100, 30) $cancel = GuiCtrlCreateButton("Cancel", 101, 330, 100, 30) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Else Endif Else Msgbox(0, "Incorrect Password", "Sorry incorect password, Please try again") Exit 0 Endif I dunno if your whole code works but the password thinggy should Edited April 21, 2006 by Paulie Link to comment Share on other sites More sharing options...
spyrorocks Posted April 21, 2006 Share Posted April 21, 2006 That works because it wont create the gui unless it is correct. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
Sublime Posted April 21, 2006 Author Share Posted April 21, 2006 (edited) Edit i found the problem you forgot a ") on line 6 and you spelld the variable wrong but that was all. It works so far thxs. But it exits instead of starting over, how do you re initialize the script. Edited April 21, 2006 by Sublime Link to comment Share on other sites More sharing options...
Paulie Posted April 21, 2006 Share Posted April 21, 2006 (edited) Ok ya i re-edited my code sry bout that umm to re-do the script, i think the easiest thing to do is to compile to ".exe" and then at the bottom of the code where it says "Exit 0" replace with run("*name of program*.exe") that should do it np Edited April 21, 2006 by Paulie Link to comment Share on other sites More sharing options...
Sublime Posted April 21, 2006 Author Share Posted April 21, 2006 (edited) Nmv i got i just replaced Exit 0 with this Do $passwd = InputBox("Security Check", "Enter your password.", "", "*") Until $passwd = "Password" Thx for the help. It an eternities worth of reading and pulling my hair out. Edited April 21, 2006 by Sublime 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