Xenobiologist Posted April 27, 2006 Share Posted April 27, 2006 Hi, sounds stupid. Maybe it is. But what is the best way to create an array with let's say 50 variables in it? I think, StringSplit won't work because I want $vars in the array and no strings. I searched a bit, but couldn't find something that helps me out. It must be easier than #include <Array.au3> Dim $avArray[ ..... ] $avArray[0] = $1 $avArray[1] = $2 $avArray[2] = $3 $avArray[3] = $4 $avArray[4] = $5 ... Thank you! So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
cdkid Posted April 27, 2006 Share Posted April 27, 2006 (edited) What about Dim $arr[49];And variables $0 - $49... For $i = 0 to 49 $arr[$i] = Eval(String($i)) Next ~cdkid Edited April 27, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide! Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 27, 2006 Author Share Posted April 27, 2006 HI, yeah I thought of that, too. But the problem is it doesn't work. $defaultstatus = "1Test" $options = "2Test" $restart = "3Test" $undo = "4Test" Dim $LabelArray = StringSplit("$defaultstatus,$options,$restart,$undo",",") MsgBox(0,"",Eval(String($LabelArray[1]))) Any ideas? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 27, 2006 Author Share Posted April 27, 2006 Hmmh, I thought there is an easy solution and someone could guide me to it. Nobody? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 27, 2006 Moderators Share Posted April 27, 2006 Hmmh, I thought there is an easy solution and someone could guide me to it. Nobody?So long,MegaI seriously don't understand what you want to do. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 27, 2006 Author Share Posted April 27, 2006 (edited) I seriously don't understand what you want to do.Hi, okay I try to make it a bit more clear. I have got a lot of variables defined in my script. And now I want to have an array with some of them likeDIM $array = $huhu, $haha, $hoho, $hehe, $andsoOnI can create something like that this way:Global $buttonArray = _ArrayCreate($ones_B, $twos_B, $threes_B, $fours_B, $fives_B, $sixes_B, $threeOK_B, $fourOK_B, _ $fullHouse_B, $shortRun_B, $longRun_B, $yahtzee_B, $chance_B)But only 21 entries.I can use _ArrayAdd() or soemthing like:#include <Array.au3> Dim $avArray[ ..... ] $avArray[0] = $1 $avArray[1] = $2 $avArray[2] = $3 $avArray[3] = $4 $avArray[4] = $5But there must be an easier way. Now a bit more clear?So long,Mega Edited April 27, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 27, 2006 Moderators Share Posted April 27, 2006 Hi, okay I try to make it a bit more clear. I have got a lot of variables defined in my script. And now I want to have an array with some of them likeDIM $array = $huhu, $haha, $hoho, $hehe, $andsoOnI can create something like that this way:Global $buttonArray = _ArrayCreate($ones_B, $twos_B, $threes_B, $fours_B, $fives_B, $sixes_B, $threeOK_B, $fourOK_B, _ $fullHouse_B, $shortRun_B, $longRun_B, $yahtzee_B, $chance_B)But only 21 entries.I can use _ArrayAdd() or soemthing like:#include <Array.au3> Dim $avArray[ ..... ] $avArray[0] = $1 $avArray[1] = $2 $avArray[2] = $3 $avArray[3] = $4 $avArray[4] = $5But there must be an easier way. Now a bit more clear?So long,MegaI don't think it's going to be easier, unless the before vars were in an array also.Dim $buttonArray[14] = ['', $ones_B, $twos_B, $threes_B, $fours_B, $fives_B, $sixes_B, $threeOK_B, $fourOK_B, $fullHouse_B, $shortRun_B, $longRun_B, $yahtzee_B, $chance_B]Could do it this way with Beta I suppose. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
exodius Posted April 28, 2006 Share Posted April 28, 2006 You know.. the limitations to _ArrayCreate only exist because that's what the function is coded as... If you copy out the function from the include you can make it capable of handling much more... This example will let you create an array with 23 elements.. You just need to add "$v_## = 0" up to the number of variables you anticipate needing to be able to add. Remember that it starts with 0, so if you go upto $v_22 then you really have 23 potential elements. Dim $Array $Array = _ArrayCreate ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 ) For $x = 1 To $Array[UBound ( $Array )-1] MsgBox ( 0, "", $Array[$x-1] ) Next ;=============================================================================== ; ; Function Name: _ArrayCreate() ; Description: Create a small array and quickly assign values. ; Parameter(s): $v_0 - The first element of the array. ; $v_1 - The second element of the array (optional). ; ... ; $v_20 - The twentyfirst element of the array (optional). ; Requirement(s): None. ; Return Value(s): The array with values. ; Author(s): Dale (Klaatu) Thompson ; Note(s): None. ; ;=============================================================================== Func _ArrayCreate($v_0, $v_1 = 0, $v_2 = 0, $v_3 = 0, $v_4 = 0, $v_5 = 0, $v_6 = 0, $v_7 = 0, $v_8 = 0, $v_9 = 0, $v_10 = 0, $v_11 = 0, $v_12 = 0, $v_13 = 0, $v_14 = 0, $v_15 = 0, $v_16 = 0, $v_17 = 0, $v_18 = 0, $v_19 = 0, $v_20 = 0, $v_21 = 0, $v_22 = 0) Local $i_UBound = @NumParams Local $av_Array[$i_UBound] Local $i_Index For $i_Index = 0 To ($i_UBound - 1) $av_Array[$i_Index] = Eval("v_" & String($i_Index)) Next Return $av_Array EndFunc ;==>_ArrayCreate Link to comment Share on other sites More sharing options...
exodius Posted April 28, 2006 Share Posted April 28, 2006 Further, does anyone know why no one has simply made the change to the _ArrayCreate function to allow it to create a lot more elements? Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 28, 2006 Author Share Posted April 28, 2006 Further, does anyone know why no one has simply made the change to the _ArrayCreate function to allow it to create a lot more elements?Thanks! Yeah, I really wanna know that, too. So long,MegaI don't think it's going to be easier, unless the before vars were in an array also.CODEDim $buttonArray[14]= ['', $ones_B, $twos_B, $threes_B, $fours_B, $fives_B, $sixes_B, $threeOK_B, $fourOK_B, $fullHouse_B, $shortRun_B, $longRun_B, $yahtzee_B, $chance_B]Could do it this way with Beta I suppose.@SmOke_N : I knew there had to be something easier. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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