Jump to content

Problem Filling Array From a Text File


Recommended Posts

When I try running the code below I get an AutoIt Error dialog box: "Error: Expected a "=" in assignment statement."

CODE
Dim $Val

$File = FileOpen ("C:\Scripts\Data\List.txt", 0)

If $File = -1 Then

MsgBox (64, "Error", "File Open Failed")

Exit

EndIf

For $I = 1 to 99

$Val ($I) = FileReadLine ("C:\Scripts\Data\List.txt")

If @error = -1 Then ExitLoop

Next

It would seem that filling an array from a text file is a pretty basic thing. So either I'm missing something real basic, or filling AutoIt arrays from a file is not as simple as it should be.

Any pointers would be appreciated.... Ò¿Ö

autoiterror.bmp

Link to comment
Share on other sites

Picaxe, Valuater's reply was just a tidyup of my code, except for the Dim (100) - which I'd already tried, but got the same error msg. I also tried not using Dim at all, with the same results.

My apologies for not being complete with what I'd already tried. I'm just getting frustrated at having such a simple thing kick my behind all around the block!

As for _FileReadToArray - Thanks! I'll try that right now.

Link to comment
Share on other sites

Picaxe, the _FileReadToArray works like a champ! Thank You!

I still feel like a dummy for not digging into the UDFs like I should have.

Anyone think that I should submit the original issue as a bug? Given the non-assistance provided by the error message?

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