Nialaghr Posted May 23, 2008 Share Posted May 23, 2008 Hi, I have three arrays and I need to display the array corresponding to the name passed from cmdline.(A1,B1 or C1) ex: #include <array.au3> $A1=_ArrayCreate("A1","A2","A3") $B1=_ArrayCreate("B1","B2","B3") $C1=_ArrayCreate("C1","C2","C3") $Name="$"& $CmdLine[1] MsgBox(0," Name",$Name) $d1 =_ArrayDisplay($Name) It looks like the variable $Name is not recognized as an Array. Thanks Link to comment Share on other sites More sharing options...
weaponx Posted May 23, 2008 Share Posted May 23, 2008 Switch $CmdLine[1] Case "A1" _ArrayDisplay($A1) Case "B1" _ArrayDisplay($B1) Case "C1" _ArrayDisplay($C1) EndSwitch Link to comment Share on other sites More sharing options...
Nialaghr Posted May 23, 2008 Author Share Posted May 23, 2008 Thanks for you answer eaponx, but since the real program is much more complex it makes is difficult to use this solution. I am really looking for a way to use the parameter passed by CmdLine[] Link to comment Share on other sites More sharing options...
weaponx Posted May 23, 2008 Share Posted May 23, 2008 #include <array.au3> $cmd = "A1" $A1=_ArrayCreate("A1","A2","A3") $B1=_ArrayCreate("B1","B2","B3") $C1=_ArrayCreate("C1","C2","C3") $temp = Eval($cmd) _ArrayDisplay($temp) Link to comment Share on other sites More sharing options...
Nialaghr Posted May 23, 2008 Author Share Posted May 23, 2008 Thanks Weaponx, exactly what I was looking for. Just learned a new command: Eval(). works great! 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