Gnat Posted August 24, 2005 Share Posted August 24, 2005 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 ....(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 More sharing options...
Holger Posted August 24, 2005 Share Posted August 24, 2005 Try using Eval:... $counter = 1001 While $counter < 1035 $control = Eval("c" & $counter) <- MsgBox(0, "Heading", $control) FileWriteLine($iniFile, GUICtrlRead($control)) ...RegardsHolger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Gnat Posted August 24, 2005 Author Share Posted August 24, 2005 Try using Eval:... $counter = 1001 While $counter < 1035 $control = Eval("c" & $counter) <- MsgBox(0, "Heading", $control) FileWriteLine($iniFile, GUICtrlRead($control)) ...RegardsHolger<{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 More sharing options...
Holger Posted August 24, 2005 Share Posted August 24, 2005 ??? GUICtrlRead _needs_ the controlID ! So long... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
wfuehrer Posted September 18, 2005 Share Posted September 18, 2005 Hi! You should use an array ( $c[1] ) instead of vars ( $c1001 ). This should work. I used that for my dynamically growing gui. So my gui can handle systems from 1 to ~20 partitions (then the screen size will be to small ). Wolfgang Führer 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