Distrophy Posted February 7, 2008 Share Posted February 7, 2008 (edited) I need help on how to go about coding this.I have a list of about 25 variables that will be set, but I want to have them print out when I call a function.$var1 = example $var2 = example $var3 = example etc.... $var 25= example Func Print() $int = 1 While $int<26 BeforeFunc() Send($var & $int) AfterFunc() $int = $int+1 Wend EndFuncWhat my code does now is print out "example1" "example2" "example3" instead of what is actually contained within the variables.I know there's probably an easy way to do this. Thanks for the help.EDIT: I figured it out using an array to store the variables and then using the while to increase the value. Edited February 7, 2008 by Distrophy Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 7, 2008 Share Posted February 7, 2008 (edited) I need help on how to go about coding this. I have a list of about 25 variables that will be set, but I want to have them print out when I call a function. What my code does now is print out "example1" "example2" "example3" instead of what is actually contained within the variables. I know there's probably an easy way to do this. Thanks for the help. EDIT: I figured it out using an array to store the variables and then using the while to increase the value. Arrays are the way to go, but your loop is still more complicated than you need. Use For/Next and let that increment the index for you: Global $avVar[25] = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", _ "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y"] Func Print() For $i = 0 To UBound($avVar) - 1 BeforeFunc() Send($avVar[$i]) AfterFunc() Next Edited February 7, 2008 by PsaltyDS 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...
Distrophy Posted February 8, 2008 Author Share Posted February 8, 2008 That's great. Thank you. 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