erbailey Posted November 1, 2006 Share Posted November 1, 2006 Im not new to the scripting world however I am new to AutoIT. I will soon be writing a script for my users but I came across a dilema. I need to be able to store a password in the script, and also be able to change that password at any given time. Is this even possible? Link to comment Share on other sites More sharing options...
_Kurt Posted November 1, 2006 Share Posted November 1, 2006 (edited) Very possible! All you need is any readable file (i prefer .dat for some reason ). Make sure you have that .dat file somewhere accessable to the script (i.e. @scriptdir & "Data\example.dat") and inside the example.dat will be the 'correct password'. I will give you an example a little later, I'm kind of busy now Edited November 1, 2006 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
erbailey Posted November 1, 2006 Author Share Posted November 1, 2006 Thank you for your responces. Basically all I need to do is upgrade what were doing now. Currently we use a Batch file to do the following net use \\ServerName001\RRM "EmailPassword" /user:EmailUsername /persistent:no pause exit This works fine, but I want to put it into an AUTOIT Script, where I can have a prompt at the start to Edit the password if need be. Link to comment Share on other sites More sharing options...
_Kurt Posted November 1, 2006 Share Posted November 1, 2006 Okay I'm back I'll cook you up a quick script in 10 minutes or so, you can study off of it Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
erbailey Posted November 1, 2006 Author Share Posted November 1, 2006 I appreciate it Link to comment Share on other sites More sharing options...
_Kurt Posted November 1, 2006 Share Posted November 1, 2006 (edited) As expected, here is the script. It's just a little quick script I wrote up. Study what I did and you should learn alot **Be sure to save and unzip before running** You're welcome, Kurt Edited November 1, 2006 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
_Kurt Posted November 1, 2006 Share Posted November 1, 2006 I can make alot more improvements if you need a better example. Adding skins and new features is just fun for me Just ask and I'll be glad to help. I'm busy right now, but I'll be back soon. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
erbailey Posted November 1, 2006 Author Share Posted November 1, 2006 This will work, this opens up alot of ideas and helps me out greatly. thanks again Link to comment Share on other sites More sharing options...
_Kurt Posted November 2, 2006 Share Posted November 2, 2006 (edited) *Small Update**Minor Bugs Fixed*Now Encrypts the new password to prevent hacking (in Password.dat)[Edit]-= NOTE: YOU WILL NEED TO SAVE/UNZIP AGAIN FOR THIS TO PROPERLY WORK =-[/Edit]Modify your Password.au3 to this:expandcollapse popup#include <GUIConstants.au3> #include <File.au3> #include <String.au3> If FileExists("Data\Password.dat") Then DirMove("Data", @TempDir & "", 1) MsgBox(0,"","The Program has detected that this is your first" & @CRLF & "time running, please click on 'Change Password'" & @CRLF & "to create your password.") EndIf $read = FileReadLine(@TempDir & "\Data\Password.dat");Read the Line of your file $readenc = _StringEncrypt(0,$read, "pass1", 4) $GUI = GUICreate("Security", 250, 80);Create the GUI GUICtrlCreateLabel("Password: ", 10, 10, 80, 20) $text = GuiCtrlCreateInput("", 90, 8, 110, 20, 0x21);Create an input box $login = GUICtrlCreateButton("Login", 150, 45, 80, 30, $BS_DEFPUSHBUTTON) $changepass = GUICtrlCreateButton("Change Password", 15, 45, 100, 30) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $login If GUICtrlRead($text) = $read Then Msgbox(0,"***CORRECT***","***CORRECT PASSWORD***") GuiCtrlSetData($text, "") ;Put whatever you want the script to do after the user puts in the correct password Else MsgBox(0,"INCORRECT","INCORRECT PASSWORD") GuiCtrlSetData($text, "") ;Put whatever you want the script to do after the user puts in the INCORRECT password EndIf Case $msg = $changepass If GUICtrlRead($text) = $read Then GUIDelete($GUI) $GUI2 = GUICreate("Change your password", 300, 80);Create the GUI GUICtrlCreateLabel("New Password: ", 10, 10, 80, 20) $text2 = GuiCtrlCreateInput("", 90, 8, 200, 20, 0x21);Create an input box $cancel = GUICtrlCreateButton("CANCEL", 180, 45, 100, 30) $changepass = GUICtrlCreateButton("OK", 5, 45, 170, 30, $BS_DEFPUSHBUTTON) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $cancel GUIDelete($GUI2) Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) Exit Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $changepass $read2 = GUICtrlRead($text2) $read2enc = _StringEncrypt(1,$read2, "pass1", 4) FileDelete(@TempDir & "\Data\Password.dat") FileWrite(@TempDir & "\Data\Password.dat", "" & $read2) GUIDelete($GUI2) Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) Exit EndSelect WEnd Else MsgBox(0,"","Before being able to change your password," & @CRLF & "Please put in your previous password and" & @CRLF & "press this button") EndIf EndSelect WEnd Exit Edited November 2, 2006 by _Kurt Awaiting Diablo III.. 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