trillion Posted November 20, 2007 Share Posted November 20, 2007 i have many variable doing different task , hope someone can fix this dead knot this variable is declared and use $1num1 ..... until $10num10 is there any way to call the above variable using a loop eg: $x =1 and loop to $x=10 , $y=1 and loop to $y=10 to fulfill this condition : if $($x)num($y) then ;{do something} thank you Link to comment Share on other sites More sharing options...
weaponx Posted November 20, 2007 Share Posted November 20, 2007 (edited) For $X = 1 to 10 ConsoleWrite(Eval($X & "num" & $X)) Next Edited November 20, 2007 by weaponx Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 20, 2007 Share Posted November 20, 2007 i have many variable doing different task , hope someone can fix this dead knot this variable is declared and use $1num1 ..... until $10num10 is there any way to call the above variable using a loop eg: $x =1 and loop to $x=10 , $y=1 and loop to $y=10 to fulfill this condition : if $($x)num($y) then ;{do something} thank you You should just work with an array: Global $avNum[10] = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90] ; indexes are 0 thru 9 $x = 1 $y = 2 $avNum[$x] = "This is my variable." $avNum[$y] = "There are many like it, but this one is mine." $avNum[$x + $y] = $avNum[$x] & " " & $avNum[$y] For $n = 0 To 9 ConsoleWrite("Debug: $avNum[" & $n & "] = " & $avNum[$n] & @LF) Next And weaponx knows better: "Assign/Eval are evil!" "Bad mutant!" 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...
weaponx Posted November 20, 2007 Share Posted November 20, 2007 I don't use either in my scripts. Much like the movie Hellraiser, I have been to the 4th dimension and I am the array master. Link to comment Share on other sites More sharing options...
Monamo Posted November 20, 2007 Share Posted November 20, 2007 I don't use either in my scripts. Much like the movie Hellraiser, I have been to the 4th dimension and I am the array master.4-dimensional arrays *shudder*Took me long enough to juggle some of my 2-dim issues effectively - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] 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