Jump to content

GUICtrlRead issue


Gnat
 Share

Recommended Posts

I am working on a script that requires a lot of input from the end-user, and then takes all of that input and stores it in an .ini file. When creating the GUICtrlCreateInputs, I assign them to a variable (ex. $var1=GUICtrlCreateInput("text", X, Y) ) and then when I try to have all of that saved to the .ini file, I use a While loop to count up the $varX variable and using a GUICtrlRead($control), but I don't get the data for the control, all I get is a bunch of zeros. I think it all has to do with the way that I am doing a count to create the controlID, but I am not sure. Can someone please help :whistle: ....(see code snippet below)...

...

$c1001 = GUICtrlCreateInput("", 100, 200)

$c1002 = GUICtrlCreateInput("", 100, 225)

etc...

...

$iniFile = FileOpen(@SystemDir & "\" & $name & ".ini", 2)

$counter = 1001

While $counter < 1035

$control = "$c" & $counter

FileWriteLine($iniFile, GUICtrlRead($control))

$counter = $counter + 1

Wend

If I put in a message box to check the value of the control's variable from the loop, I get the right output for the controlID's assigned variable.

...

$c1001 = GUICtrlCreateInput("", 100, 200)

$c1002 = GUICtrlCreateInput("", 100, 225)

etc...

...

$iniFile = FileOpen(@SystemDir & "\" & $name & ".ini", 2)

$counter = 1001

While $counter < 1035

$control = "$c" & $counter

MsgBox(0, "Heading", $control)

FileWriteLine($iniFile, GUICtrlRead($control))

$counter = $counter + 1

Wend

Thanx in advance...

Link to comment
Share on other sites

Try using Eval:

...
$counter = 1001
While $counter < 1035
$control = Eval("c" & $counter) <-
MsgBox(0, "Heading", $control)
FileWriteLine($iniFile, GUICtrlRead($control))
...

Regards

Holger

Link to comment
Share on other sites

Try using Eval:

...
$counter = 1001
While $counter < 1035
$control = Eval("c" & $counter) <-
MsgBox(0, "Heading", $control)
FileWriteLine($iniFile, GUICtrlRead($control))
...

Regards

Holger

<{POST_SNAPBACK}>

That gives me the actual controlID number and unfortunately does not fulfill my requirements. Thanx anyway.
Link to comment
Share on other sites

  • 4 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...