jedd999 Posted July 24, 2013 Share Posted July 24, 2013 (edited) I have a bit of a problem that ive been trying to sort out, and cant seem to find the information. I have a situation like this: $Array1[3] = [ "List1", "List2", "List3" ] $List1 = _FileListToArray("xxx")$List2 = _FileListToArray("yyy") $List3 = _FileListToArray("zzz") Rather than pointing specifically to the List I want to access, I want to use the string from Array1 to access the List Arrays... How can I access any elements in $List1, $List2, or $List3 with only the STRING "List1", "List2" or "List3" from the Array1 variable. Edited July 24, 2013 by jedd999 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2013 Moderators Share Posted July 24, 2013 jedd999,You can do it like this: Local $Array1[3] = [ "List1", "List2", "List3" ] Local $List1[3] = [1, 2, 3] Local $List2[3] = [4, 5, 6] Local $List3[3] = [7, 8, 9] $aArray = Eval($Array1[0]) MsgBox(4096, $Array1[0], $aArray[0] & " - " & $aArray[1] & " - " & $aArray[2]) $aArray = Eval($Array1[1]) MsgBox(4096, $Array1[1], $aArray[0] & " - " & $aArray[1] & " - " & $aArray[2]) $aArray = Eval($Array1[2]) MsgBox(4096, $Array1[2], $aArray[0] & " - " & $aArray[1] & " - " & $aArray[2])But I think it is very ugly code. What exactly are you trying to do? We might be able to suggest something a little more elegant. 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...
jedd999 Posted July 24, 2013 Author Share Posted July 24, 2013 The Eval function is exactly what I was looking for. Basically, I have 4 folders with a bunch of files in them. I wanted to create 4 different groups in a GUI with the list of all the files organized by group. Eval works great! Thanks 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