Sign in to follow this  
Followers 0
johna007

Autolt Error on strings

3 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


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

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