Sign in to follow this  
Followers 0
skippynz

array error

6 posts in this topic

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

Share this post


Link to post
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


[center]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.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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


[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

so i should be using UBound($responding_1) - 1 instead of $responding_1[$x]) on the For $x = 1 to line ? is that right ?

ok just tested and worked a treat... thanks for that SmOke_N

your help is appreciated.

Share this post


Link to post
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
Sign in to follow this  
Followers 0