c.haslam Posted July 12, 2015 Share Posted July 12, 2015 (edited) This works in a long script:Local $ar,$vec For $fnam in $udfFnamsVec $vec = GetFnamsInaMgmt_Hhc('udf',$gudfLvlFnamAr,$fnam) For $i = 0 to UBound($vec)-1 Local $tvec = [$vec[$i],$fnam] AppendRowToArray($ar,$tvec) Next Nextbut this gives a syntax error:Local $ar,$vec,$tvec For $fnam in $udfFnamsVec $vec = GetFnamsInaMgmt_Hhc('udf',$gudfLvlFnamAr,$fnam) For $i = 0 to UBound($vec)-1 $tvec = [$vec[$i],$fnam] AppendRowToArray($ar,$tvec) Next NextWhy? Edited July 12, 2015 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Developers Jos Posted July 12, 2015 Developers Share Posted July 12, 2015 You could have summarized it that this works:Local $tvec = [$vec[$i],$fnam]And this gives an Error:$tvec = [$vec[$i],$fnam]You are trying to define an Array and need to use Dim/Global/LocalJos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
c.haslam Posted July 12, 2015 Author Share Posted July 12, 2015 (edited) OK. But consider $vec:On the first line of my code, it is declared (as a scalar?)On the third line, AutoIt changes it to being a vector, because the function returns a vector.Am I correct?Please also consider $ar. A 2D array had been assigned to it in a previous line of the code. Despite declaring it (without a value) on line 1 of the code above, it picked up the previous value, assigned earlier in the function. So re-declaring a variable as Local with no initial value does nothing.I solved the problem by changing the first line toLocal $ar='',$vecAm I correct?I looked in the Help but did not find anything there to help.BTW I see that Language Reference > Variables still shows Map, despite Jon having withdrawn this feature. Perhaps it should either be removed or mentioned as a future feature.Further, as I read this help topic, I see Using empty [ ] declares a Map but an example of an array is Local $vVar[] = [1, 2, 3]. Is Using empty [] without an initializer declares a Map intended?I am using v. 3.3.14.0 Edited July 12, 2015 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 12, 2015 Moderators Share Posted July 12, 2015 c.haslam,Every time you declare an array (whether empty or filled) you must use a scoping keyword - that is probably the only reason that we keep Dim, so that you can re-declare an array in a UDF without worrying whether it was Local or Global in scope in the calling script.The Map stuff on that page should have been removed - but as it will still be in the next Beta I am not going to lose any sleep over its inclusion.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...
c.haslam Posted July 14, 2015 Author Share Posted July 14, 2015 Thank you Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard 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