Sign in to follow this  
Followers 0
deef99

Subscript used with non-Array variable What???

2 posts in this topic

Can anyone please tell me what this means or where to look to fix it?

C:\Program Files\AutoIt3\Examples\Filet6.au3 (22) : ==> Subscript used with non-Array variable.

Here's a snippet of the script...line 22 is in RED. I've been trying alot of things...I just don't understand arrays I guess. I would of done this reading line by line [files are all 40 lines], but the HELP said don't do it that way [read line and increment by 1]. How to you retrieve a line in an array and read a part of it?

Any help would be appreciated!

#include<File.au3>

#include "array.au3"

#include "Date.au3"

#include "String.au3"

Global $array

Global $sFile

;Global $al ;array line

Global $s0 ;skill 400 level

Global $s1 ;skill 401 level

Global $s3 ;skill 403 level

Global $agt ;701 or 702 ard or cov agent

dim $aRecords

Global $vrec

$al = 5

$read = _FileReadToArray("c:\temp\tt.text", $array)

$filenew = FileOpen("c:\temp\tnew.txt", 0)

$al = 5

;For $al = 5 to $aRecords[0]

While $al <> $aRecords[0]

$vrec = _ArrayToString($array, @TAB, $al, $al)

MsgBox(0, "al", $al&" "&$aRecords)

If StringRight($vrec, 3) = "400" Then

$al = $al + 1

$s0 = StringRight($vrec, 3)

Endif

I also used to have this, but it gave me the same error on the first line below:

If stringRight($array[$al],3) = "400" Then

$al = $al+1

$s0 = stringRight($array[$al],1)

FileWriteLine($filenew,"SetArr(2,2)= " & $s0)

Endif

Share this post


Link to post
Share on other sites



$aRecords is not an array.

You get that error when you try to use an array element which doesn't exist.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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