SuperFletch Posted January 5, 2007 Share Posted January 5, 2007 Hello, Bit new to all this so go easy please!! Ive created a simple GUI that asks for the person running the script to enter three values. A generic username and password as well as a unique identifier. What I now want to do is get the GUI to retain that data for use later in the script (to log in to various applications) after the continue button is pressed. My script should be shown below can anyone help?? Thanks, Matt. #include <GUIConstants.au3> ; GUI GuiCreate("Please enter the details requested:", 400, 400) GUICtrlCreateLabel("Please enter a username and password which has",70,60) GUICtrlCreateLabel("full access to the FMS module. When entering the",70,75) GUICtrlCreateLabel("DFES number of the school please include the 908",70,90) GUICtrlCreateLabel("prefix or the number will not be validated.",70,105) GUICtrlCreateLabel("FMS Username:", 20, 200, 130, 20) GUICtrlCreateLabel("FMS Password:", 20, 230, 130, 20) GUICtrlCreateLabel("School DFES Number:", 20, 260, 130, 20) $USER = GuiCtrlCreateInput("", 200, 193, 130, 20) $PASS = GuiCtrlCreateInput("", 200, 223, 130, 20) $DFES = GuiCtrlCreateInput("", 200, 253, 130, 20) GuiCtrlCreateButton("Continue", 10, 330, 100, 30) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 5, 2007 Moderators Share Posted January 5, 2007 Look at "Variable" and "GUICtrlRead" in the help file. 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...
SuperFletch Posted January 5, 2007 Author Share Posted January 5, 2007 Look at "Variable" and "GUICtrlRead" in the help file.Thanks, I'd looked at various bits of the help but couldn't make enough sense of them to work out which ones I needed.Knowing that these are the functions I need will definately help. Link to comment Share on other sites More sharing options...
Uten Posted January 5, 2007 Share Posted January 5, 2007 Try this. Have not tested it so typos might occur.. expandcollapse popup#include <GUIConstants.au3> Local $user, $pwd, $id If guiUserID($user, $pwd, $id) ;Continue MsgBox(48, "User ok", "Hello " & $user) Else MsgBox(16, "User canceled", "Hello " & $user) EndIf Func guiUserID(ByRef $user, ByRef $pwd, ByRef $id) ; GUI Local $gui = GuiCreate("Please enter the details requested:", 400, 400) GUICtrlCreateLabel("Please enter a username and password which has",70,60) GUICtrlCreateLabel("full access to the FMS module. When entering the",70,75) GUICtrlCreateLabel("DFES number of the school please include the 908",70,90) GUICtrlCreateLabel("prefix or the number will not be validated.",70,105) GUICtrlCreateLabel("FMS Username:", 20, 200, 130, 20) GUICtrlCreateLabel("FMS Password:", 20, 230, 130, 20) GUICtrlCreateLabel("School DFES Number:", 20, 260, 130, 20) Local $USERCTL = GuiCtrlCreateInput("", 200, 193, 130, 20) Local $PASSCTL = GuiCtrlCreateInput("", 200, 223, 130, 20) Local $DFESCTL = GuiCtrlCreateInput("", 200, 253, 130, 20) ;Excped you to create cancel button? Local $cancel = 1 ; Local $CONTINUECTL = GuiCtrlCreateButton("Continue", 10, 330, 100, 30) Local $CANCELCTL = GuiCtrlCreateButton("Cancel", 10 + 100 + 5, 330, 100, 30) GuiSetState() Local $msg Do $msg = GuiGetMsg() Switch $msg Case $CANCELCTL ExitLoop Case $CONTINUECTL $cancel = 0 ExitLoop EndSwitch Until $msg = $GUI_EVENT_CLOSE IF $cancel = 0 Then $user = GuiCtrlRead($USERCTL) $pwd = GuiCtrlRead($PASSCTL) $id = GuiCtrlRead($DFESCTL) Endif GUIDelete($gui) ; Note assosiatig the variable name correctly with a true or false Return Not $cancel EndFunc Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Lempke Posted January 9, 2007 Share Posted January 9, 2007 I did a simular thing like this with an INI file. Create the ini with the value's entered by the user. (GuiCtrlRead and IniWrite) Later in another script using the same value's with IniRead to a $Var Link to comment Share on other sites More sharing options...
SuperFletch Posted January 9, 2007 Author Share Posted January 9, 2007 Thanks folks. I've got it done now, and put in an exit button too!! (Always planned to honest)! After a lot of tinkering it even works - well chuffed. 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