Jkeith247 Posted September 21, 2011 Share Posted September 21, 2011 (edited) Hello all, A quick question... well hopefully I am trying to read 366 lines of an ini file and instead of typing every line individually, I am trying to use For....Next to read them to an array and then write them to a GuiCtrlCreateList. For some reason when I execute this snippet of code I am getting this error "Error: Expected a "=" operator in assignment statement." I am sure that this snippet of code is the cause as when I block comment it, the error goes away. Could someone please help? Thanks! Func Exceptions() For $i = 1 To 366 Step 1 $aArray[$i] = IniRead($sini, $i, "Exception", "") Next For $element In $aArray $string = GUICtrlSetData($events, $element) Next EndFunc ;==>Exceptions Edited September 21, 2011 by Jkeith247 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 21, 2011 Moderators Share Posted September 21, 2011 Jkeith247, Firstly you do not need the [ ] around the $i in the IniRead statement - if you fix that you will at least read the ini data correctly. Other than that the snippet is syntactically correct and I am not sure why you get that particular error. What exactly are you trying to to with the For...In loop? At the moment you seem to be setting $string to the result of the final GUICtrlSetData command and setting the text of $events to the value of the final element of the array. Is that the desired result? Can we have a bit of context? What kind of control is $events? And can we see a bit of the ini file to make sure you are getting what you think you are? 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...
Jkeith247 Posted September 21, 2011 Author Share Posted September 21, 2011 (edited) Yeah, lol I saw those [ ] in the ini and fixed.... silly syntax mistake. Basically I have written a scheduling program and when the person opens this program, I want it to display any exceptions that they have created in a GuiCtrlCreateList. So to avoid having to write 366 lines of ini reads and then manually type all 366 variables in a GuiCtrlSetData($events.... I am trying to use For...In to place all of the variables from the previously created array in the GuiCtrlSetData. The syntax in the ini will include the "|" appended to each entry so hopefully the end result will be a correctly populated list. Here is an example of the ini text [1] Exception=All on at 3:30| [2] Exception=All off at 4:25| [3] Exception=All on at 3:30| [10] Exception=All off at 4:20| Also, there may not be entries for every single day of the year wich explains why I am skipping 4-9 in this snippet of ini. I have set the default of the INIread to "" in the assumption that if the variable is empty then it will not show appear in the GuiCtrlCreateList as a blank line. Thank you for your help! Edited September 21, 2011 by Jkeith247 Link to comment Share on other sites More sharing options...
Jkeith247 Posted September 21, 2011 Author Share Posted September 21, 2011 (edited) Silly silly silly.... I forgot to state the size of my array in the beginning of my code.... So I no longer get the error when executing the script, but now I am on to another question. As you mentioned earlier, What exactly are you trying to to with the For...In loop? At the moment you seem to be setting $string to the result of the final GUICtrlSetData command and setting the text of $events to the value of the final element of the array. Is that the desired result? I think I am only getting the last entry in the array. Is there a way to include all entries of the array in the For...In? In the online documentation it appears as though every element of the array will be included with For...In, but this does not seem to be the case. Am I gonna be stuck with a 366 entry GuiCtrlSetData? Basically, I am searching for a way to take all elements of a single array and make them into one long string.... Edited September 21, 2011 by Jkeith247 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 21, 2011 Moderators Share Posted September 21, 2011 Jkeith247,Basically, I am searching for a way to take all elements of a single array and make them into one long string....Then perhaps:_ArrayToString - Places the elements of an array into a single string, separated by the specified delimitermight be the solution? 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...
Jkeith247 Posted September 21, 2011 Author Share Posted September 21, 2011 HAHA! That did the trick! Thank you very much for the help! I think I may need to get out of the habit of using the online documentation and start using the help file more. I wish I saw that yesterday, as this would have made life way easier. Thank you so much! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 21, 2011 Moderators Share Posted September 21, 2011 Jkeith247, My pleasure. 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