Makiix3 Posted July 13, 2011 Share Posted July 13, 2011 (edited) So here is what i want to do: I want to create a password check that shows up for example a message whenever i type in the correct password. After that it should Exit. Also whenver i press cancel the programm should escape too. Can any1 tell what´s wrong with my code? $i = InputBox("Passwordcheck","Insert Password","","*") If $i = "hlMG83csk" Then MsgBox(0,"Sucess","Correct Password") Exit ElseIf $i = 2 Then Exit ElseIf $i <> "hlMG83csk" Or 2 Then $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*") EndIf If $x = "hlMG83csk" Then MsgBox(0,"Sucess","Correct Password") Exit ElseIf $x <> "hlMG83csk" Or 2 Then Do Inputbox("Passwordcheck","Wrong Password.Try Again!","","*") Until $x = "hlMG83csk" Msgbox(0,"Sucess","Correct Password") Exit EndIf PS: hlMG83csk is the password 2 is stands only for Cancel but I´m not sure if it´s right formulated. Edited July 13, 2011 by Makiix3 Link to comment Share on other sites More sharing options...
guinness Posted July 13, 2011 Share Posted July 13, 2011 I would read the Forum Rules first as the title of the InputBox is a little suggestive. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Makiix3 Posted July 13, 2011 Author Share Posted July 13, 2011 Sry i did not know about that. It was just some random title. Thx for your advice. Link to comment Share on other sites More sharing options...
hannes08 Posted July 13, 2011 Share Posted July 13, 2011 Hi Makiix, first, you don't need two "if .. then .. elseif .. then .. endif" constructs. One should be enough. Second, strip the last elseif to else, because it already checked whether your input is 2 or the correct password. Third, storing clear-text passwords is never a good idea. Better would be using hashes or encryption. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Makiix3 Posted July 13, 2011 Author Share Posted July 13, 2011 Thx for your fast response. But get syntax error if i change the last ElseIf to Else. C:\Users\Max\****\*******.au3(13,7) : ERROR: syntax error Else $x ~~~~~^ C:\Users\Max\****\*******.au3 - 1 error(s), 0 warning(s) Link to comment Share on other sites More sharing options...
hannes08 Posted July 13, 2011 Share Posted July 13, 2011 ;One time check: $i = InputBox("Passwordcheck","Insert Password","","*") If $i = "hlMG83csk" Then MsgBox(0,"Sucess","Correct Password") Exit ElseIf $i = 2 Then Exit Else $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*") EndIf ;Two time check For $i = 0 To 1 $i = InputBox("Passwordcheck","Insert Password","","*") If $i = "hlMG83csk" Then MsgBox(0,"Sucess","Correct Password") Exit ElseIf $i = 2 Then Exit Else $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*") EndIf Next ;Continious check While 1 $i = InputBox("Passwordcheck","Insert Password","","*") If $i = "hlMG83csk" Then MsgBox(0,"Sucess","Correct Password") Exit ElseIf $i = 2 Then Exit Else $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*") EndIf WEnd I suggest you to read the sections about loops and conditional statements in the helpfile. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Makiix3 Posted July 13, 2011 Author Share Posted July 13, 2011 (edited) Still don´t work as it should but I´ll try to fixx it after rereading conditional statements and loops. Thx anyways Edited July 13, 2011 by Makiix3 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