Jujo Posted April 21, 2009 Share Posted April 21, 2009 Hi, folks. I have become very familiar with AutoIt, and I just love it I use it for everyday actions while starting up PC and that stuff, as well as in school. So, today I need some help. I have function that has 8 parameters named $1, $2, $3, etc. and in that function I have a For chain that is supposed to do an action depending on parameter's value (0 or 1). This is what I have: For $i = 1 To 7 Step 1 If ($[$i] = 1) Then USBSetDigitalChannel($i) ElseIf ($[$i] = 0) Then USBClearDigitalChannel($i) EndIf Next As you can see, I have the whole code except the $[$i] part, since I have no idea how to use current $i value as variable name. So, please help me. Thanks P.S. I now use If... Else for every parameter (that is 8 loops), but that is pretty slow and I don't think it will work. Also, what would happen if I have random number of variables, or 100 variables TY Link to comment Share on other sites More sharing options...
weaponx Posted April 21, 2009 Share Posted April 21, 2009 Dim $aValues[8] = [0,1,0,0,0,0,0,1] For $i = 0 to 7 If ($aValues[$i] = 1) Then USBSetDigitalChannel($i) ElseIf ($aValues[$i] = 0) Then USBClearDigitalChannel($i) EndIf Next Link to comment Share on other sites More sharing options...
Jujo Posted April 21, 2009 Author Share Posted April 21, 2009 Thanks 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