jack71 Posted January 10, 2015 Share Posted January 10, 2015 I have a loop that I want to have create a multi-variable variable, dumbed down ex: local $test[0] local $i = 1 For $i 1 to 20 local $test$i = _ArrayAdd($test$i, "Color" & $i) local $test$i = _ArrayAdd($test$i, "Type" & $i) Next I want to retrieve some information via WMI and keep each device in its separate array but can't figure out how to create multivariable variables, if that's even possible. I've tried declaring it as $test & $i, $test&$i, and $test($i) and it's not working. I'm probably screwing up syntax somewhere? Thanks Link to comment Share on other sites More sharing options...
JohnOne Posted January 10, 2015 Share Posted January 10, 2015 local $test[0] local $i = 1 For $i 1 to 20 _ArrayAdd($test, "Color" & $i) _ArrayAdd($test, "Type" & $i) Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jack71 Posted January 10, 2015 Author Share Posted January 10, 2015 local $test[0] local $i = 1 For $i 1 to 20 _ArrayAdd($test, "Color" & $i) _ArrayAdd($test, "Type" & $i) Next Hey JohnOne, The goal is to have 20 created arrays (or until @error): $test1, $test2, $test3.....$test20 Each array will represent a hardware component, and in each array the component's settings. Link to comment Share on other sites More sharing options...
Valuater Posted January 10, 2015 Share Posted January 10, 2015 (edited) Just trying to understand your direction... I would build an "ini" file with the info Use iniread() to build its own array/variable 8) EDIT: Example https://www.autoitscript.com/autoit3/docs/functions/IniReadSection.htm Edited January 10, 2015 by Valuater Link to comment Share on other sites More sharing options...
jack71 Posted January 10, 2015 Author Share Posted January 10, 2015 (edited) Just trying to understand your direction... I would build an "ini" file with the info Use iniread() to build its own array/variable 8) So is it not possible to create an array via loop with a number appended to it based on $i? $i = 1 therefore $test1[0] $i = 2 then...$test2[0] I just don't know how many arrays I need to declare because it depends on the number of keys found in the registry. Edited January 10, 2015 by jack71 Link to comment Share on other sites More sharing options...
Valuater Posted January 10, 2015 Share Posted January 10, 2015 Yes it is. you need a two dimensional array ( multi-dimensional) Like... $Test[0][0] 8) Link to comment Share on other sites More sharing options...
jack71 Posted January 10, 2015 Author Share Posted January 10, 2015 Yes it is. you need a two dimensional array ( multi-dimensional) Like... $Test[0][0] 8) I wanted to keep it simple. For example if I have 2 network cards installed, 1 wifi, 1 LAN I want $test1 to contain all the information of the wifi card, and $test2 to contain all the information of the LAN card. Link to comment Share on other sites More sharing options...
JohnOne Posted January 10, 2015 Share Posted January 10, 2015 What you're wanting to do is taking it away from simple and more complicated, I'm not even sure you can do that. But you can have an array of arrays. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jack71 Posted January 10, 2015 Author Share Posted January 10, 2015 I'll try the iniwrite and iniread workaround. Link to comment Share on other sites More sharing options...
Valuater Posted January 10, 2015 Share Posted January 10, 2015 it is possible to do something like this $Test1 = "WIFI,g,b,n,etc" then later use stringsplit() by commas to create an array of the values needed 8) jack71 1 Link to comment Share on other sites More sharing options...
jack71 Posted January 10, 2015 Author Share Posted January 10, 2015 it is possible to do something like this $Test1 = "WIFI,g,b,n,etc" then later use stringsplit() by commas to create an array of the values needed 8) Good idea Link to comment Share on other sites More sharing options...
JohnOne Posted January 10, 2015 Share Posted January 10, 2015 Then you have an array of strings, is that what you want? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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