Jump to content

array error


Recommended Posts

hi guys

can you tell me why i get this error ": ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: " in SciTe when running this ?? im sure it use to work before i updated to the latest Beta.

For $x = 1 To $responding_1[0]
    $responding_1a = StringStripCR($responding_1[$x])
    If $responding_1a <> '' Then
        FileWriteLine(@ScriptDir & "\checks.txt", $responding_1a)
    EndIf
Next
Link to comment
Share on other sites

  • Moderators

Try this and see how many elements $responding_1 is holding::

MsgBox(0, 'Element Test', 'Number of elements found for this array: ' & Ubound($responding_1) - 1)
Use this in place of the For/Next loop

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Try this and see how many elements $responding_1 is holding::

MsgBox(0, 'Element Test', 'Number of elements found for this array: ' & Ubound($responding_1) - 1)
Use this in place of the For/Next loop
says there are 25 elements.

to make it clear its failing on this line

$responding_1a = StringStripCR($responding_1[$x])

Edited by craig.gill
Link to comment
Share on other sites

  • Moderators

It's not failing on that line for me, it's not even making it to the loop, so $responding[0] is the issue.... Try this:

Dim $responding_1[2]
$responding_1[1] = 'This is a test' & @CR & 'And only a test'
MsgBox(0, UBound($responding_1) - 1, $responding_1[1])
For $x = 1 To UBound($responding_1) - 1
    MsgBox(0, '', $responding_1[$x])
    $responding_1a = StringStripCR($responding_1[$x])
    If $responding_1a <> '' Then
        ConsoleWrite($responding_1a);FileWriteLine(@ScriptDir & "\checks.txt", $responding_1a)
    EndIf
Next

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

It's not failing on that line for me, it's not even making it to the loop, so $responding[0] is the issue.... Try this:

Dim $responding_1[2]
$responding_1[1] = 'This is a test' & @CR & 'And only a test'
MsgBox(0, UBound($responding_1) - 1, $responding_1[1])
For $x = 1 To UBound($responding_1) - 1
    MsgBox(0, '', $responding_1[$x])
    $responding_1a = StringStripCR($responding_1[$x])
    If $responding_1a <> '' Then
        ConsoleWrite($responding_1a);FileWriteLine(@ScriptDir & "\checks.txt", $responding_1a)
    EndIf
Next
so i should be using UBound($responding_1) - 1 instead of $responding_1[$x]) on the For $x = 1 to line ? is that right ? Edited by craig.gill
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...