anyday Posted March 21, 2006 Share Posted March 21, 2006 im making a GUI for a website i use for work. i have a password tab with login and pass text box fields. is there a way to make the variables once they are entered into the gui permanent unless changed again? that way the user does not have to enter his password everytime he runs the script? Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 21, 2006 Share Posted March 21, 2006 im making a GUI for a website i use for work. i have a password tab with login and pass text box fields.is there a way to make the variables once they are entered into the gui permanent unless changed again?that way the user does not have to enter his password everytime he runs the script?That sounds on first blush like a phenominally bad idea, but....You can read the input box control and save it to a variable for as long as the script is running. To save it for next time the script runs, you'll have to write it to the registry or a file. Keep in mind that neither of those options is secure. Store it with some encryption at the very least! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
cppman Posted March 22, 2006 Share Posted March 22, 2006 im making a GUI for a website i use for work. i have a password tab with login and pass text box fields.is there a way to make the variables once they are entered into the gui permanent unless changed again?that way the user does not have to enter his password everytime he runs the script?are you trying to make this like how programs have, 'Remember Me. Remember My Password' when u login..? something like that? Miva OS Project Link to comment Share on other sites More sharing options...
anyday Posted March 22, 2006 Author Share Posted March 22, 2006 yea i just need a way to make it that everytime a use runs the gui it they dont have to put there login pass in again Link to comment Share on other sites More sharing options...
jvanegmond Posted March 22, 2006 Share Posted March 22, 2006 Oh yeah, i used IniWrite for that.. Here's a little big (sorry) example: I translated, simplified and modified it into this: expandcollapse popup#Include <GUIConstants.au3> GUICreate("Serverroperties", 300,255) GUICtrlCreateGroup("Login", 10, 13, 280, 83) GUICtrlCreateLabel("usersnaam:", 18, 33, 80) $useredit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "user", ""), 110, 31, 170) GUICtrlCreateLabel("password:", 18, 58) $passwordedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "password", ""), 110, 56, 170) GUICtrlCreateGroup("",-99,-99,1,1) GUICtrlCreateGroup("Server", 10, 100, 280, 105) GUICtrlCreateLabel("Server:", 18, 120) $serveredit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "server", ""), 110, 118, 170) GUICtrlCreateLabel("Database:", 18, 145) $databaseedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "database", ""), 110, 143, 170) GUICtrlCreateLabel("table:", 18, 170) $tableedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "table", ""), 110, 168, 170) GUICtrlCreateGroup("",-99,-99,1,1) $ok = GUICtrlCreateButton("Ok", 135, 220, 60, 25) $annuleren = GUICtrlCreateButton("Cancel", 205, 220, 80, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $annuleren Then GUIDelete() ExitLoop EndIf If $msg = $ok Then IniWrite(@ScriptDir & "\data.ini", "Server", "user", GUICtrlRead($useredit)) IniWrite(@ScriptDir & "\data.ini", "Server", "password", GUICtrlRead($passwordedit)) IniWrite(@ScriptDir & "\data.ini", "Server", "server", GUICtrlRead($serveredit)) IniWrite(@ScriptDir & "\data.ini", "Server", "database", GUICtrlRead($databaseedit)) IniWrite(@ScriptDir & "\data.ini", "Server", "table", GUICtrlRead($tableedit)) GUIDelete() ExitLoop EndIf WEnd github.com/jvanegmond Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 22, 2006 Share Posted March 22, 2006 Oh yeah, i used IniWrite for that.. Here's a little big (sorry) example:I translated, simplified and modified it into this:CODE#Include <GUIConstants.au3>GUICreate("Serverroperties", 300,255)GUICtrlCreateGroup("Login", 10, 13, 280, 83)GUICtrlCreateLabel("usersnaam:", 18, 33, 80)$useredit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "user", ""), 110, 31, 170)GUICtrlCreateLabel("password:", 18, 58)$passwordedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "password", ""), 110, 56, 170)GUICtrlCreateGroup("",-99,-99,1,1)GUICtrlCreateGroup("Server", 10, 100, 280, 105)GUICtrlCreateLabel("Server:", 18, 120)$serveredit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "server", ""), 110, 118, 170)GUICtrlCreateLabel("Database:", 18, 145)$databaseedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "database", ""), 110, 143, 170)GUICtrlCreateLabel("table:", 18, 170)$tableedit = GUICtrlCreateInput(IniRead(@ScriptDir & "\data.ini", "Server", "table", ""), 110, 168, 170)GUICtrlCreateGroup("",-99,-99,1,1)$ok = GUICtrlCreateButton("Ok", 135, 220, 60, 25)$annuleren = GUICtrlCreateButton("Cancel", 205, 220, 80, 25)GUISetState()While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $annuleren Then GUIDelete() ExitLoop EndIf If $msg = $ok Then IniWrite(@ScriptDir & "\data.ini", "Server", "user", GUICtrlRead($useredit)) IniWrite(@ScriptDir & "\data.ini", "Server", "password", GUICtrlRead($passwordedit)) IniWrite(@ScriptDir & "\data.ini", "Server", "server", GUICtrlRead($serveredit)) IniWrite(@ScriptDir & "\data.ini", "Server", "database", GUICtrlRead($databaseedit)) IniWrite(@ScriptDir & "\data.ini", "Server", "table", GUICtrlRead($tableedit)) GUIDelete() ExitLoop EndIfWEndJust a note of caution: That will write the password IN THE CLEAR to the .ini file! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
GaryFrost Posted March 22, 2006 Share Posted March 22, 2006 I have to agree that saving the password to a file is a bad idea, but your going to do it, I would encrypt when saving to the file and decrypt after reading from the file. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
anyday Posted March 22, 2006 Author Share Posted March 22, 2006 thanks for the help guys, that worked great, i had to modify the code a bit to fit my gui needs but yall have been very helpfull. now i gotta search on how to encrypt the passes i dunno if there is a thread already on this forum or not, i dont do well with forums any advice would be helpfull. Link to comment Share on other sites More sharing options...
anyday Posted March 22, 2006 Author Share Posted March 22, 2006 Manadar, I used that code and it works good but when i call the for the $username and $password down further in the script i dont got anything close to what the user enter's into the user and pass fields? 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