Damein Posted February 23, 2011 Share Posted February 23, 2011 (edited) Not 100% sure how to ask this, so let me show you an example. #include <GUIConstantsEx.au3> GuiCreate("Test GUI") $1 = GuiCtrlCreateLabel("This is a test label 1", 5,30) $2 = GuiCtrlCreateLabel("This is a test label 2", 5,60) $3 = GuiCtrlCreateLabel("This is a test label 3", 5,90) GuiSetState() While 1 For $Count = 0 To 4 Step +1 GuiCtrlSetData($Count, "Change to me!") Sleep(600) GuiCtrlSetData($Count, "Then back to original!") Sleep(600) GuiCtrlSetData($Count, "This is a test label " & $Count) Sleep(600) Next $Count = 0 Sleep(10) WEnd So in this script I would assume that on each go it would change one label, starting at 1, since Count would be the numeral 1 and the label has the numeral one as well. I may be assuming too much and the Count var does not actually call upon the $1 as I thought it would, if this is the case then is there a way to do this? Thanks. As a side note, running the script as is will change the first and second label, but will also display it as the count being 3 for 1 and 4 for 2 on the labels. So I'm not 100% what is going on. Edited February 23, 2011 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2011 Moderators Share Posted February 23, 2011 Damein, I may be assuming too muchCorrect! The variable names are $1, $2 and $3, while $Count is set to 1, 2 and 3. You need to use Execute like this: #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "On_Exit") GuiCreate("Test GUI") $1 = GuiCtrlCreateLabel("This is a test label 1", 5, 30, 200) $2 = GuiCtrlCreateLabel("This is a test label 2", 5, 60, 200) $3 = GuiCtrlCreateLabel("This is a test label 3", 5, 90, 200) GuiSetState() While 1 For $Count = 1 To 3 GuiCtrlSetData(Execute("$" & $Count), "Change to me!") Sleep(600) GuiCtrlSetData(Execute("$" & $Count), "Then back to original!") Sleep(600) GuiCtrlSetData(Execute("$" & $Count), "This is a test label " & $Count) Sleep(600) Next $Count = 0 Sleep(10) WEnd Func On_Exit() Exit EndFunc The Execute function returns the content of the variable defined by "$" & $count - which is the ControlID of the label. However, the more elegant way to do this is using an array like this: #include <GUIConstantsEx.au3> HotKeySet("{ESC}", "On_Exit") Global $aLabels[4] GuiCreate("Test GUI") $aLabels[1] = GuiCtrlCreateLabel("This is a test label 1", 5, 30, 200) $aLabels[2] = GuiCtrlCreateLabel("This is a test label 2", 5, 60, 200) $aLabels[3] = GuiCtrlCreateLabel("This is a test label 3", 5, 90, 200) GuiSetState() While 1 For $Count = 1 To 3 Step +1 GuiCtrlSetData($aLabels[$Count], "Change to me!") Sleep(600) GuiCtrlSetData($aLabels[$Count], "Then back to original!") Sleep(600) GuiCtrlSetData($aLabels[$Count], "This is a test label " & $Count) Sleep(600) Next $Count = 0 Sleep(10) WEnd Func On_Exit() Exit EndFunc Now you do not need the clumsy Execute statements. All clear? Ask if not. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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