Mercury049 Posted April 9, 2009 Share Posted April 9, 2009 Ok, I'm using the Excel.au3 UDF to return a column of information to me in an array. Now, for each element returned, I need to turn that element into it's own stand-alone array to hold data that's associated to it. So, how can I dynamically, on-the-fly create arrays that are named the same as each element in the original array? Thanks Link to comment Share on other sites More sharing options...
KaFu Posted April 9, 2009 Share Posted April 9, 2009 #include <array.au3> global $array_org[5] = ['a','b','c','d','e'] global $array_new[1] redim $array_new[UBound($array_org)][2]; keep in mind that arrays are 0-based for $i = 0 to UBound($array_org) - 1 $array_new[$i][0] = $array_org[$i] $array_new[$i][1] = $i +1 next _ArrayDisplay($array_new) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Mercury049 Posted April 13, 2009 Author Share Posted April 13, 2009 #include <array.au3> global $array_org[5] = ['a','b','c','d','e'] global $array_new[1] redim $array_new[UBound($array_org)][2]; keep in mind that arrays are 0-based for $i = 0 to UBound($array_org) - 1 $array_new[$i][0] = $array_org[$i] $array_new[$i][1] = $i +1 next _ArrayDisplay($array_new) Thanks for the help, but I have a bit of a follow up/re adjustment to my question. I need for the array to be named for one of the values in $array_org. But going into it, I won't know the values of that array until I run it. basically, as this loops through, I am going to have around 100 arrays or so. Each one needs to be named something different. So to take from your example above, I would have 5 different arrays when it's all said and done. $a $b $c $d $e But how can I tell AutoIT the name of these variable arrays at run time? Does this question make any sense? Thanks Link to comment Share on other sites More sharing options...
Aceguy Posted April 13, 2009 Share Posted April 13, 2009 not sure i understand..... try writing out how you would like the array to look.? [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 13, 2009 Share Posted April 13, 2009 Thanks for the help, but I have a bit of a follow up/re adjustment to my question. I need for the array to be named for one of the values in $array_org. But going into it, I won't know the values of that array until I run it. basically, as this loops through, I am going to have around 100 arrays or so. Each one needs to be named something different. So to take from your example above, I would have 5 different arrays when it's all said and done. $a $b $c $d $e But how can I tell AutoIT the name of these variable arrays at run time? Does this question make any sense? Thanks Just use a 2D array: #include <Array.au3> Global $avOriginal[5] = ["a", "bee", "See", "13.0", "14"] ; Add attributes for each Global $avNew[UBound($avOriginal) + 1][3] = [[UBound($avOriginal), "Length", "StringIsInt"]] For $n = 0 To UBound($avOriginal) - 1 $avNew[$n + 1][0] = $avOriginal[$n] $avNew[$n + 1][1] = StringLen($avOriginal[$n]) $avNew[$n + 1][2] = StringIsInt($avOriginal[$n]) Next ; Display results _ArrayDisplay($avNew, "$avNew") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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