Nadsky Posted November 8, 2018 Share Posted November 8, 2018 (edited) Hi Everyone, First of all still new with AutoIt so i still have a lot of things to learn. I'm trying to create a simple GUI that can automate some of my office task including VPN login. Almost done with everything, I just need your advice for username and password part of the GUI. Is there a way to save the username and password from the username and password field without saving it from a text or ini file? This might be a dumb question but just wanted to check. I want to save it to a blank variable like $sUsername = "", $sPassword = "" then save the username/password, remove or change it. I've attached the username and password part of my GUI. If it's saved then the username and password field will automatically be populated if there is a previous saved username/password. Is it possible? Kindly need you inputs and advice. Thanks! Sorry for not adding the code. Anyway, here it is: I was able to get other functions working except the username and password that has the green comments. Need your inputs on how to do it. Thanks! expandcollapse popup$sTALUsername = "" ;Username will be saved in this variable $sTALPassword = "" ;Password wil be saved in this variable #Region ### START Koda GUI section ### Form=c:\users\nad\desktop\talv1.kxf Global $TALV1 = GUICreate("AutoV1", 492, 168, 192, 124) Global $RDP183 = GUICtrlCreateButton("192.168.99.183", 8, 40, 99, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $RDP184 = GUICtrlCreateButton("192.168.99.184", 8, 72, 99, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $RDP241 = GUICtrlCreateButton("192.168.99.241", 8, 104, 99, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $RDP203 = GUICtrlCreateButton("10.50.68.203", 8, 136, 99, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $CDC201 = GUICtrlCreateButton("CDC", 112, 40, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $GPL142 = GUICtrlCreateButton("GPL", 112, 72, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $AMMIS = GUICtrlCreateButton("AMMIS", 112, 104, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $sTALUsername = GUICtrlCreateInput("USERNAME", 352, 8, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) ;Save the username in variable $sTALUsername Global $sTALPassword = GUICtrlCreateInput("Password", 352, 32, 129, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_PASSWORD)) ; Save password in variable $sTALPassword Global $SaveCreds = GUICtrlCreateCheckbox("Save", 352, 56, 57, 25) ;If checked, password will be saved to the variable until changed by a new username and password Global $OK = GUICtrlCreateButton("OK", 440, 56, 43, 25) ;Confirm and saved username and password GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ConnectGPA = GUICtrlCreateButton("Connect to GPA", 352, 96, 131, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $AutoStartRDP = GUICtrlCreateCheckbox("Auto Start RDP", 200, 16, 121, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $AutoMoveResize = GUICtrlCreateCheckbox("Auto Move / Resize", 200, 40, 145, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Start = GUICtrlCreateButton("Start", 224, 64, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $ManualButton = GUICtrlCreateLabel("Start RDP Individually", 32, 16, 133, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $RDP183 HDCPRPT001() Case $RDP184 HDCPRPT002() Case $RDP241 PA32() Case $RDP203 PA37() Case $CDC201 PA31() Case $GPL142 GPL() Case $AMMIS AMMIS() Case $ConnectGPA confirmGPA() Case $OK If GUICtrlRead($SaveCreds) = 1 Then EndIf Edited November 9, 2018 by Nadsky Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 Hi, Welcome to the forums and AutoIt. Please insert your code or create a simplified version of it for us to help. You know, compare apples with raspberries to get Apples with Microsoft... Yeah i know, IT joke... Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 8, 2018 Moderators Share Posted November 8, 2018 @Nadsky although I didn't understand the IT joke above, the basic principle is sound; we cannot do much to help based off a screenshot. This is a coding forum; in order to best help you we need to see your code. That said, if you are taking in input from the user (be it sensitive or not) there are only so many things you can do with it: you can declare the variable and hold it in memory (good only for as long as the parent process is running) you can store it in a file on the hard drive or local network (be it database, text, ini, etc. etc), encrypted, hashed, permission-locked, etc. you can store it in the registry write out to an online repository In all cases, you have to understand that AutoIt is not going to be 100% secure, anyone will be able to read your source code with very little effort. The question of "how do I 100% protect sensitive data in my script?" has been asked and answered so many times that we simply don't discuss any longer. If you determine how you would like to store the data specifically, please let us know and we will do our best to assist Xandy 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Nadsky Posted November 9, 2018 Author Share Posted November 9, 2018 Hi JLogan3o13, I already added the code. The password doesn't have to be encrypted or anything. This program is just for a personal use so a simple code sample to make the username and password input to work would be fine. Link to comment Share on other sites More sharing options...
Nine Posted November 10, 2018 Share Posted November 10, 2018 look at iniwrite () and iniread () in file functions of autoit help file. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 10, 2018 Moderators Share Posted November 10, 2018 Yes, what he said (or I said two days ago) To your response @Nadsky I provided the options you have, it is up to you to decide which you would like to try, at which point we can assist. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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