SuperFletch 0 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 Share this post Link to post Share on other sites
SmOke_N 207 Posted January 5, 2007 Look at "Variable" and "GUICtrlRead" in the help file. Hide SmOke_N's signature Hide all signatures 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. Share this post Link to post Share on other sites
SuperFletch 0 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. Share this post Link to post Share on other sites
Uten 9 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 Hide Uten's signature Hide all signatures 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 Share this post Link to post Share on other sites
Lempke 0 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 Share this post Link to post Share on other sites
SuperFletch 0 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. Share this post Link to post Share on other sites