markj Posted March 23, 2006 Share Posted March 23, 2006 Hii have a gui with an input box. i want the value of this input box to be the default value of another input box but it wont let me the bits that matter are the first input box:$Input_1 = GUICtrlCreateInput("", 90, 480, 250, 25)and the new input box; ParametersFunc RemoteInfo(ByRef $Computer, ByRef $Account, ByRef $Password) $iOk = 0 $Info = GuiCreate("Enter parameters", 200, 140, -1, -1, -1, $WS_EX_TOPMOST) GUICtrlCreateLabel("Computer name", 5, 8, 80, 20) $CompName = GUICtrlCreateInput($Input_1, 85, 5, 110, 20) GUICtrlCreateLabel("Account", 5, 38, 80, 20) $Login = GUICtrlCreateInput("administrator", 85, 35, 110, 20) GUICtrlCreateLabel("Password", 5, 68, 80, 20) $Passwd = GUICtrlCreateInput("", 85, 65, 110, 20, $ES_PASSWORD) $btnOk = GUICtrlCreateButton("&Ok", 100, 100, 40, 30) $btnCancel = GUICtrlCreateButton("&Cancel", 150, 100, 40, 30) GuiSetState() While 1 $msg2 = GuiGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE Or $msg2 = $btnCancel ExitLoop Case $msg2 = $btnOk $Computer = GUICtrlRead($CompName) $Account = GUICtrlRead($Login) $Password = GUICtrlRead($Passwd) $iOk = 1 ExitLoop EndSelect WEnd GUISwitch($MainGui) GuiDelete($Info) Return $iOkEndFunc when i try to run it i get told that i havent declared the variable - am i missing something?Thanks Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 23, 2006 Moderators Share Posted March 23, 2006 Well if your using $Info1 outside the actual function, you'll probably need to Declare it Global. Also, if you are wanting the information inside of that Input, then you'll also might want to use GUICtrlRead($Input1), otherwise you'll just get the Control ID unless that's what your going for. 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...
EFF Posted March 23, 2006 Share Posted March 23, 2006 while 1 $msg2 = GuiGetMsg() $i1 = GUICtrlRead($input1) $si2 = GUICtrlSetData($CompName,$i1) sleep(200) wend Register those inputs as globals if you use them inside function. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted March 23, 2006 Share Posted March 23, 2006 why don't you just use @computername in your function? is your function is in front of your script? (if so change it ) my little chatmy little encryption toolmy little hidermy unsafe clickbot 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