Jump to content

Autolt Error on strings


Recommended Posts

My program after running for 3 mins OK then gives me a Error :-

$check = StringLen ( $array[4] )

$check = StringLen ( ^ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

This is part of my program :-

While 1

$All = ClipGet()

$array = StringSplit($All, Chr(13))

$check = StringLen ( $array[4] )

;

; My program

;

WEnd

Please help

John

Link to comment
Share on other sites

  • Developers

you need to test if the Stringsplit really returned an array with at least 5 entries...

While 1
    $All = ClipGet()
    $array = StringSplit($All, Chr(13))
    If UBound($array) > 4 then 
        $check = StringLen ( $array[4] )
    Else
    ; $array[4] doesn't exist
    EndIf
    
;
; My program
;
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

I've found out the answer i have to slow part of the program down

While 1

send("^c")

Sleep(100) ; Slow it down

$All = ClipGet()

$array = StringSplit($All, Chr(13))

$check = StringLen ( $array[4] )

;

; My program

;

WEnd

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