Jump to content

Error: Subscript used with non-Array variable.


copyright
 Share

Recommended Posts

While $loop = "yes"

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass1")

If $pos[0] = 8 Then

$classnumber = 1

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass2")

If $pos[0] = 8 Then

$classnumber = 2

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass3")

If $pos[0] = 8 Then

$classnumber = 3

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass4")

If $pos[0] = 8 Then

$classnumber = 4

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass5")

If $pos[0] = 8 Then

$classnumber = 5

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass6")

If $pos[0] = 8 Then

$classnumber = 6

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass7")

If $pos[0] = 8 Then

$classnumber = 7

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass8")

If $pos[0] = 8 Then

$classnumber = 8

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass9")

If $pos[0] = 8 Then

$classnumber = 9

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass10")

If $pos[0] = 8 Then

$classnumber = 10

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass11")

If $pos[0] = 8 Then

$classnumber = 11

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass12")

If $pos[0] = 8 Then

$classnumber = 12

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass13")

If $pos[0] = 8 Then

$classnumber = 13

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass14")

If $pos[0] = 8 Then

$classnumber = 14

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass15")

If $pos[0] = 8 Then

$classnumber = 15

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass16")

If $pos[0] = 8 Then

$classnumber = 16

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass17")

If $pos[0] = 8 Then

$classnumber = 17

Endif

$pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass18")

If $pos[0] = 8 Then

$classnumber = 18

Endif

Wend

I keep getting:

If $pos[0]= 8 Then

If $pos^ ERROR

Error: Subscript used with non-Array variable.

The reason for the loop:

classname keeps changing and i want to use $pos[0] to identify which class name it is at the moment. then use $classnumber like:

$var = ControlGetText(" Ares - [Chat]", "", "TTntEdit.UnicodeClass"&$classnumber)

^ that part works.. but the loop doesnt.
Link to comment
Share on other sites

  • Developers

I keep getting:

The reason for the loop:

classname keeps changing and i want to use $pos[0] to identify which class name it is at the moment. then use $classnumber like:

^ that part works.. but the loop doesnt.

<{POST_SNAPBACK}>

You first need to test if the controlGetPos was successful, because in case of failure it doesn't return an Array.

something like this should do it:

While $loop = "yes"
   For $x = 1 To 18
      $pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass" & $x)
      If Not @error Then
         If $pos[0] = 8 Then
            $classnumber = $x
            ExitLoop
         EndIf
      EndIf
   Next
Wend

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You first need to test if the controlGetPos was successful, because in case of failure it doesn't return an Array.

something like this should do it:

While $loop = "yes"
   For $x = 1 To 18
      $pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass" & $x)
      If Not @error Then
         If $pos[0] = 8 Then
            $classnumber = $x
            ExitLoop
         EndIf
      EndIf
   Next
Wend

<{POST_SNAPBACK}>

kudos for you! you rock.. i changed it a little

While $loop = "yes"

  For $x = 1 To 18

    $pos = ControlGetPos(" Ares - [Chat]", "", "TTntEdit.UnicodeClass" & $x)

    If Not @error Then

        If $pos[0] = 8 Then

          $TTntEditUnicodeClass = "TTntEdit.UnicodeClass" & $x

        EndIf

    EndIf

  Next

Wend

hehe ( a little ) just cleaned up the variable for future reference..

btw.. how can i run two loops at the same time? so while that loop is running i can have other loops going also ? would i need to use dual scripting ?

Link to comment
Share on other sites

  • Developers

kudos for you! you rock.. i changed it a little

hehe ( a little ) just cleaned up the variable for future reference..

btw.. how can i run two loops at the same time? so while that loop is running i can have other loops going also ? would i need to use dual scripting ?

<{POST_SNAPBACK}>

don't know what you want to accomplish here, could you explain ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...