Search the Community
Showing results for tags '_stringsize'.
-
I have a script that calls _ExtMsgBox() from time to time to show progress through the test script by displaying the current line number and I'm getting a subscripting error. My script makes this call: _ExtMsgBox($MB_ICONINFORMATION, "OK", "Test", @ScriptLineNumber) The error was: "C:\Andy\AutoIT-src\myLib\_ExtMsgBox.au3" (787) : ==> Subscript used on non-accessible variable.: _ExtMsgBoxSet(0, 0, -1, -1, 10, "Courier New", $aRet[2] + 70) _ExtMsgBoxSet(0, 0, -1, -1, 10, "Courier New", $aRet^ ERROR I traced it to a problem in _StringSize() where it returns an error if the first parameter is not a string. The code in _ExtMsgBox() does not check for an error and assumes that _StringSize() returns an array. However, it returns a 0, causing the subssript error. The problem is that because AutoIT has non-typed variables, a text string of all digits and a numeric value both fail the IsString() test. For example, both of these calls fail: So there really are 2 issues here: 1) The _ExtMsgBox() code does not check for an error return from _StringSize() 2) _StringSize() fails when a string containing all digits is passed as the first parameter. I commented out the "if not isString" test and it all worked OK. I don't know why this check is there as a call with a number as the first parameter just displays the number as a string of digits.
- 10 replies
-
- _extmsgbox
- _stringsize
-
(and 1 more)
Tagged with: