JohnOne Posted February 1, 2015 Share Posted February 1, 2015 (edited) After a search, I keep seeing answers "Upgrade to newer version of AutoIt" however I believe the error is still present in 3.3.12.0. I don't believe this belongs in GHAS forum, as there is obviously an undealt with array out of bounds problem in my script, it's just that it could cause confusion when the error is pointing to the wrong place. Here is the func it errors out on, it's not runnable on it's own of course. Func _LinksActual($Host) $iHTMLArrayCurrentIndex = 4 $aHTMLArray[$iHTMLArrayCurrentIndex] = '4 - Link index<br><br>' Local $iHostIndex = _ArraySearch($HostAndLinkArray, $Host, 0, 0, 0, 0, 1, 1) If Not @error Then Local $FoundHost = $HostAndLinkArray[$iHostIndex][0] While $HostAndLinkArray[$iHostIndex][0] = $FoundHost $HostSource = BinaryToString(InetRead($HostAndLinkArray[$iHostIndex][1])) $Link = _StringBetween($HostSource, 'myButton" href="', '">Click')[0] $aHTMLArray[$iHTMLArrayCurrentIndex] &= '<a href="' & $Link & '">' & $Link & '</a><br>' $iHostIndex += 1 Sleep(500) WEnd ;Wierd error here if no links actual are found ;"C:\Documents and Settings\JOHN\Documents\AU3\Projects\WSB.au3" (16) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: ;WEnd ;WEnd^ ERROR Else EndIf _IEBodyWriteHTML($aMainControl[$H_IEOBJ], $aHTMLArray[$iHTMLArrayCurrentIndex]) Return EndFunc ;==>_LinksActual The only thing I can see which could go wrong here which might cause this, is if the line While $HostAndLinkArray[$iHostIndex][0] = $FoundHost EDIT: Just for the record, it was that line erroring out, because it was fixed with Func _LinksActual($Host) $iHTMLArrayCurrentIndex = 4 $aHTMLArray[$iHTMLArrayCurrentIndex] = '4 - Link index<br><br>' Local $iHostIndex = _ArraySearch($HostAndLinkArray, $Host, 0, 0, 0, 0, 1, 1) If Not @error Then Local $FoundHost = $HostAndLinkArray[$iHostIndex][0] While $iHostIndex < UBound($HostAndLinkArray) And $HostAndLinkArray[$iHostIndex][0] = $FoundHost $HostSource = BinaryToString(InetRead($HostAndLinkArray[$iHostIndex][1])) $Link = _StringBetween($HostSource, 'myButton" href="', '">Click')[0] $aHTMLArray[$iHTMLArrayCurrentIndex] &= '<a href="' & $Link & '">' & $Link & '</a><br>' $iHostIndex += 1 Sleep(500) WEnd Else $iHTMLArrayCurrentIndex -= 1 Return EndIf _IEBodyWriteHTML($aMainControl[$H_IEOBJ], $aHTMLArray[$iHTMLArrayCurrentIndex]) Return EndFunc ;==>_LinksActual Edited February 1, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted February 2, 2015 Share Posted February 2, 2015 (edited) I can't help wondering if this is perhaps a bit of a trade-off. The code terminates abruptly before ever reaching WEnd because of an out of bounds array error. Interpreting events like this may not be practical beyond a certain point. It could simply be a knock-on effect. Whether this is the case here, I really don't know. I would rather the interpreter threw out all the errors it encounters, and if fixing one of them fixes them all, I'm more than happy. Edited February 2, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JohnOne Posted February 2, 2015 Author Share Posted February 2, 2015 Here is a simple reproducer. $i = 0 Local $aArray[4] = [1,2,3,4] While $aArray[$i] ConsoleWrite($aArray[$i] & @LF) $i += 1 Sleep(500) WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jpm Posted February 3, 2015 Share Posted February 3, 2015 So the concerne is in the line where the error show up. The while line should be better as the error is really when referencing a wrong entry right ? Link to comment Share on other sites More sharing options...
czardas Posted February 3, 2015 Share Posted February 3, 2015 (edited) It would make it easier to debug the code, so I would say yes. Edited February 3, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
JohnOne Posted February 3, 2015 Author Share Posted February 3, 2015 So the concerne is in the line where the error show up. The while line should be better as the error is really when referencing a wrong entry right ? Yes exactly that. In a busier while loop, and if you don't know why it occurs, could be confusing. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
czardas Posted February 3, 2015 Share Posted February 3, 2015 Thanks for looking into this. operator64 ArrayWorkshop 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