JimC Posted August 8, 2007 Share Posted August 8, 2007 I know this is probably something stupid, but I kepp getting an error when the array his number 77 becasue there are only 76 hotfixes to intgrate. How do i tell the array to only goto ubound -1 ? Here is my code: for $c = 0 to ubound($arr1)-1 $var= $arr1[$c] $message = GUICtrlCreateLabel('Integrating: ' & $arr1[$c] , 10, 405, 570, 20) ;ShellExecuteWait($var, $parameters,$hfdir) $sExtCmd = $hfdir & "\" & $arr1[$c] & ' /integrate:' & $xpcd & ' /passive /norestart /overwriteoem' ConsoleWrite("Debug: $sExtCmd = " & $sExtCmd & @LF) $RET = RunWait($sExtCmd, $hfdir) ConsoleWrite("Debug: $RET = " & $RET & @LF) sleep(1000) GUICtrlDelete($message) Next Thanks in advance for any help ... Link to comment Share on other sites More sharing options...
ssubirias3 Posted August 8, 2007 Share Posted August 8, 2007 (edited) I know this is probably something stupid, but I kepp getting an error when the array his number 77 becasue there are only 76 hotfixes to intgrate. How do i tell the array to only goto ubound -1 ? Here is my code: for $c = 0 to ubound($arr1)-1 $var= $arr1[$c] $message = GUICtrlCreateLabel('Integrating: ' & $arr1[$c] , 10, 405, 570, 20) ;ShellExecuteWait($var, $parameters,$hfdir) $sExtCmd = $hfdir & "\" & $arr1[$c] & ' /integrate:' & $xpcd & ' /passive /norestart /overwriteoem' ConsoleWrite("Debug: $sExtCmd = " & $sExtCmd & @LF) $RET = RunWait($sExtCmd, $hfdir) ConsoleWrite("Debug: $RET = " & $RET & @LF) sleep(1000) GUICtrlDelete($message) Next Thanks in advance for any help ...Hi JimC - Now I'm new at this array stuff so I hope I don't make matters worse for you sharing my limited new understanding. To your specific question of how do you tell to only goto ubound -1... I think you're not thinking of ubound -1 correctly. From your code it looks like you have the syntax correct. I'm going to assume the above is not your entire code and most importantly that you've declared your $arr1 well before the for $c = 0 to ubound($arr1)-1. If not, then that's one of the problems. Also is your $arr1 1 or 2 dimensional. Assuming its a 1d array, this how you can think of UBound. This is only an example and will not work if you cut and paste into your code. Dim $arr1[76] = ["hotfix1, .... "hotfix76"] For $c = 0 To UBound($arr1)-1 ;; .... your code here .... NextoÝ÷ Ù8^ä¢iÙ"rK(}ö¥¢ZÛ¶Í7é If you modifed the "UBound($myArray,?) -1" and the "Dim $myArray[?][?]" values then see that $r and $c are set to different values. As written above $r = 0 to 10 -1 is what $r = 0 to UBound($myArray,1) - 1 means. Likewise in the above example code $c = 0 to 20 -1 is what $c = 0 to UBound($myArray, 2) - 1 means. Now if your $arr1 is a 1d array defined as "Dim $arr1[76] = ["hotfix1, .... "hotfix76"]" as mentioned above, and you do NOT want your loop to read values starting at index 0 and reading the complete array to index 75, BUT rather you DO want your script to only read from index 0 to index 12, then that's where the "- 1" in UBound($arr1) - 1 comes into play. As you increase the "- 1" to "- 15" what you're telling the script is $c = 0 To 61 and any values from index 62 to index 75 will be ignored. I hope I explained this correctly and if I did, then I hope this helps you. And if I have this complete wrong, will someone who actually knows what they are talking about show me where I'm wrong... please??!! Edited August 8, 2007 by ssubirias3 Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 8, 2007 Share Posted August 8, 2007 I know this is probably something stupid, but I kepp getting an error when the array his number 77 becasue there are only 76 hotfixes to intgrate. How do i tell the array to only goto ubound -1 ? Here is my code:Run it in SciTE and post the error message from the console... I don't see any reason for the error in the snippet you showed. 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...
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