damon Posted July 26, 2010 Share Posted July 26, 2010 I have search and found a few things that I tried but they did not work. So I decided to post. If this is covered somewhere else I would appriciate a link or a keyword to search for. I am writing to an .ini file an encrypted password. The problem I am having is that I can not get it to recognize the fact that some letters are capitalized and other are not. whats going on: If I use =, it will encrypt and write to my .ini file but when I use ==, it will give me the else msgbox that i have setup. Things I have tried. ---Things I found in other posts. tried with = and == If Not ($NewPass1 == $RePass1) Then MsgBox (0,"PassWord Error", "Your Passwords do not match." & @CRLF & "Please Try Again") Else encrypt($RePass1) EndIf tried with = and == If Not ($NewPass1 == $RePass1) Then encrypt($RePass1) Else MsgBox (0,"PassWord Error", "Your Passwords do not match." & @CRLF & "Please Try Again") EndIf This is my Password script below. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <String.au3> #Region ### START Koda GUI section ### Form=C:\Users\Damon\Desktop\encrypt\encrypt.kxf $Form2 = GUICreate("TN Password Change", 318, 205, -1, -1) GUISetIcon("D:\008.ico") GUISetBkColor(0xB9D1EA) $EnterPassLabel = GUICtrlCreateLabel("Current Password", 32, 12, 125, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $CurrPass = GUICtrlCreateInput("", 184, 8, 105, 24, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("New Password", 51, 76, 106, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $NewPass = GUICtrlCreateInput("", 184, 72, 105, 24, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Re-Type Password", 20, 116, 137, 20) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $RePass = GUICtrlCreateInput("", 184, 112, 105, 24, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL)) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $ButtonOk = GUICtrlCreateButton("&OK", 214, 160, 75, 25, 0) $ButtonCancel = GUICtrlCreateButton("&Cancel", 119, 160, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ButtonOk $CurrPassRead = GUICtrlRead ($CurrPass) If Decrypt() == $CurrPassRead Then $NewPass1 = GUICtrlRead ($NewPass) $RePass1 = GUICtrlRead ($RePass) If $NewPass1 == $RePass1 Then encrypt($RePass1) Else MsgBox (0,"PassWord Error", "Your Passwords do not match." & @CRLF & "Please Try Again") EndIf Else MsgBox (0,"Password Error", "The Password you entered is incorrect." & @CRLF & "Please try again") EndIf GUICtrlSetData ($CurrPass, "") GUICtrlSetData ($NewPass, "") GUICtrlSetData ($RePass, "") Case $ButtonCancel Exit EndSwitch WEnd Func encrypt($NewPass1) $Pass = _StringEncrypt (1, $RePass1, "Sup3rS!z3", 2) IniWrite (@ScriptDir & "\config.ini", "Configuration", "Config", $Pass) EndFunc Func Decrypt() $CurrPassrecover = IniRead (@ScriptDir & "\config.ini", "Configuration", "Config","") $Pass = _StringEncrypt (0, $CurrPassrecover, "Sup3rS!z3", 2) Return $Pass EndFunc It always amazes me how one little thing can cause so much havoc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 26, 2010 Moderators Share Posted July 26, 2010 (edited) If StringCompare("a", "A") = 0 Then MsgBox(16, "Error", "a does not equal A") Else MsgBox(64, "Success", "Proper match ... ""a"" does not equal ""A""") EndIf Edited July 26, 2010 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
damon Posted July 26, 2010 Author Share Posted July 26, 2010 If StringCompare("a", "A") = 0 Then MsgBox(16, "Error", "a does not equal A") Else MsgBox(64, "Success", "Proper match ... ""a"" does not equal ""A""") EndIf that is what I was looking for. Thank you, It always amazes me how one little thing can cause so much havoc 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