Bluhair Posted June 17, 2008 Share Posted June 17, 2008 This seems logical to me but not Autoit. Calculating command on the fly ? Example: $Label1= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15) $Label2= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15) $Label3= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15) For $i = 1 to 3 GuiCtrlSetData ("$Label"&$i, "Result " & $i) Next My goal was to Set the data in the three labels. Autoit returned no error message and no results. Any suggestions ? Thank You in advance. Bluhair Link to comment Share on other sites More sharing options...
sandin Posted June 17, 2008 Share Posted June 17, 2008 you must use array, and not "$Label"&$i dim $label[4] $Label[1]= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15) $Label[2]= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15) $Label[3]= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15) For $i = 1 to 3 GuiCtrlSetData ($label[$i], "Result " & $i) Next Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Bluhair Posted June 17, 2008 Author Share Posted June 17, 2008 Interesting idea and I will probably use that in the future. However, I am trying to populate existing Labels with new data. Thank you for your reply. Link to comment Share on other sites More sharing options...
TurionAltec Posted June 17, 2008 Share Posted June 17, 2008 Look at the Eval() function $Label1= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15) $Label2= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15) $Label3= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15) For $i = 1 to 3 GuiCtrlSetData (Eval("$Label"&$i), "Result " & $i) Next Though really arrays are probably the better way Link to comment Share on other sites More sharing options...
Malkey Posted June 17, 2008 Share Posted June 17, 2008 Yet another way for your consideration. #include <GUIConstantsEx.au3> local $width=500,$height=300,$Label1,$Label2,$Label3,$num=0 $hGui = GUICreate("GUI", $width, $height, -1, -1) GUISetState() $Label1= GuiCtrlCreateLabel("Test1", 5, 30, 100, 15) $Label2= GuiCtrlCreateLabel("Test2", 5, 45, 100, 15) $Label3= GuiCtrlCreateLabel("Test3", 5, 60, 100, 15) ; Because the labels were created sequencially, the labels' ; identifiers (controlID) are numbered sequencially. For $i = $Label1 to $Label3 $num +=1 GuiCtrlSetData ($i, "Result " & $num) ;$i being the controlID when label created. Next do sleep(10) Until GUIGetMsg() = $GUI_EVENT_CLOSE 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