Password compare routine
#1
Posted 18 May 2012 - 02:30 PM
All I want is to be able to compare two GUI input boxes and when they match have an ICON displayed at the end of the confirm box showing that they do indeed match. All my ideas on how to do it fail miserably.
Is this something that's possible with AutoIT? I've seen it done with vbscript and an hta gui but I can't find anything on how to do it with AutoIT.
#2
Posted 18 May 2012 - 02:32 PM
So what code have you tried that has not worked?
M23
Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display
RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#3
Posted 18 May 2012 - 02:34 PM
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#4
Posted 18 May 2012 - 02:44 PM
Take a look at GUICtrlRead()
#5
Posted 18 May 2012 - 02:44 PM
I've tried some if then statements to compare the values, and even some loops, do while and the like.
#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $PWStatus = "stop.ico" #Region ### START Koda GUI section ### Form=C:UserswhalmichDesktopScriptsKodaFormsPWConfirm.kxf $Form1 = GUICreate("Form1", 615, 440, -1, -1) $Input1 = GUICtrlCreateInput("", 232, 176, 177, 21, 0x0020) GUICtrlCreateLabel("Password", 96, 176, 50, 17) $Input2 = GUICtrlCreateInput("", 232, 224, 177, 21, 0x0020) GUICtrlCreateLabel("Confirm Password", 96, 224, 88, 17) $Icon1 = GUICtrlCreateIcon($PWStatus, -1, 432, 224, 25, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
#6
Posted 18 May 2012 - 02:50 PM
#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $PWStatus = "stop.ico" #region ### START Koda GUI section ### Form=C:UserswhalmichDesktopScriptsKodaFormsPWConfirm.kxf $Form1 = GUICreate("Form1", 615, 440, -1, -1) $Input1 = GUICtrlCreateInput("", 232, 176, 177, 21, 0x0020) GUICtrlCreateLabel("Password", 96, 176, 50, 17) $Input2 = GUICtrlCreateInput("", 232, 224, 177, 21, 0x0020) GUICtrlCreateLabel("Confirm Password", 96, 224, 88, 17) $Icon1 = GUICtrlCreateIcon($PWStatus, -1, 432, 224, 25, 25) $hBtnCompare = GUICtrlCreateButton("Compare", 420, 224, 55, 21) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hBtnCompare If GUICtrlRead($Input1) <> GUICtrlRead($Input2) Then MsgBox(16, "Passwort Comapre", "Passwords are not equal!") EndSwitch WEnd
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#7
Posted 18 May 2012 - 03:03 PM
I think I might have to just go with the error checking when they click the OK box.
#8
Posted 18 May 2012 - 03:04 PM
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#9
Posted 18 May 2012 - 03:13 PM
Should be possible. But how will you know that the user has finished to enter the 2nd password?
Ideally when they both match. That's the thing I can't figure out how to do this as the user types their password and not after they click Ok to go on.
#10
Posted 18 May 2012 - 03:19 PM
So the user needs to click a button, leave the input field or press enter to let the script know that he finished to enter the password.
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
#11
Posted 18 May 2012 - 03:26 PM
Now it works perfectly just like this but I wanted the password checking to be real time. It would not kick off any action until the user clicks Ok.
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $Sysprep = "C:WindowsPantherunattend.xml" Global $Flag = 1 Global $sIni = @TempDir & "TAG.ini" ServiceTag() #Region ### START Koda GUI section ### Form=c:userswhalmichdesktopscriptskodaformsnathans.kxf $Form1_ = GUICreate("Ghost Win7", 465, 320, -1, -1) GUICtrlCreateLabel("Enter Computer Name", 80, 80, 108, 17) $PCName = GUICtrlCreateInput(IniRead($sIni, 'HW Info', 'Service Tag', ''), 224, 80, 121, 21) GUICtrlCreateLabel("Enter Username", 80, 120, 80, 17) $User = GUICtrlCreateInput("", 224, 120, 121, 21) GUICtrlCreateLabel("Enter Password", 80, 160, 78, 17) $Password = GUICtrlCreateInput("", 224, 160, 121, 21, 0x0020) GUICtrlCreateLabel("Confirm Password", 80, 200, 88, 17) $ConfirmPassword = GUICtrlCreateInput("", 224, 200, 121, 21, 0x0020) $OKButton = GUICtrlCreateButton("Ok", 96, 240, 75, 25) $Diskpart = GUICtrlCreateButton("Diskpart", 296, 240, 57, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OKButton GUISetState(@SW_Hide) If GUICtrlRead($PCName) = "" or GUICtrlRead($User) = "" or GUICtrlRead($Password) = "" Then MsgBox(16, "Error", "You must supply a value for each field!") GUISetState(@SW_SHOW) Else If GUICtrlRead($Password) == GUICtrlRead($ConfirmPassword) Then Runwait(@ComSpec & " /c "& "Ghost32.exe -CLONE,mode=restore,src=@MCc,dst=1 -sure",@WindowsDir,@SW_SHOW) UpdateSysprep() RunWait(@ComSpec & ' /c ' & 'wpeutil Reboot') Exit Else MsgBox(16, "Invalid Password", "The password you typed does not match!") GUISetState(@SW_SHOW) EndIf EndIf Case $Diskpart DiskpartDrive() GUISetState(@SW_SHOW) EndSwitch WEnd Func UpdateSysprep() While $Flag = 1 $Text = FileRead($Sysprep,FileGetSize($Sysprep)) $Text = StringReplace($Text, "%ComputerName%", GUICtrlRead($PCname)) $Text = StringReplace($Text, "%UserName%", GUICtrlRead($User)) $Text = StringReplace($Text, "%Password%", GUICtrlRead($Password)) FileDelete($Sysprep) FileWrite($Sysprep,$Text) FileClose($Sysprep) $Flag = 0 Wend EndFunc Func ServiceTag() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_ComputerSystemProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem In $colItems IniWrite($sIni, "HW Info", "Service Tag", $objItem.IdentifyingNumber) Next EndFunc Func DiskpartDrive() GUISetState(@SW_HIDE) $ConfirmDP = MsgBox(4, "Clean Disk 0", "This will clean disk 0 and create a new partition." & @CRLF & "You should remove any external drives just to be safe."& @CRLF & "" & @CRLF & "Are you sure you want to continue?") If $ConfirmDP = 7 Then Else $DPCommands = @TempDir & "dpcommands.txt" FileWriteLine($dpcommands, "select disk 0") FileWriteLine($dpcommands, "clean") FileWriteLine($dpcommands, "create partition primary") FileWriteLine($dpcommands, "select partition 1") FileWriteLine($dpcommands, "active") FileWriteLine($dpcommands, "assign") RunWait(@ComSpec & ' /c diskpart /s ' & $DPCommands) MsgBox(0, "Complete", "Diskpart Completed.", 5) FileDelete($DPCommands) EndIf EndFunc
#12
Posted 18 May 2012 - 04:00 PM
Will post as soon as I find something.
UDFs:
Active Directory (2012-10-12 - Version 1.3.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2012-10-07 - Version 0.9.0.0 released) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1 released) - Download - General Help & Support - Example Scripts
WordEX (2012-12-29 - Version 1.3 released) - Download
ExcelEX (2013-05-11 - Alpha 4 released) - Download
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




