Jump to content

Recommended Posts

Posted

Hi

i 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 :mellow:

the bits that matter are the first input box:

$Input_1 = GUICtrlCreateInput("", 90, 480, 250, 25)

and the new input box

; Parameters

Func 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 $iOk

EndFunc

:) when i try to run it i get told that i havent declared the variable - am i missing something?

Thanks

  • Moderators
Posted

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.

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...