Jump to content
Sign in to follow this  
Frankie Paul

Fileread Problem

Recommended Posts

Frankie Paul

hoi,hoi all,

i having trouble with a script i was to read 4 field from a file and take though values and write them to another spot the problem is there are lines of junk in between that i need to ignore and in some cases i only want to use one work noth the whole line is there anything i can can do to do this if you can please help

thank you

Frankie PAul


ƒrankie Paul

Share this post


Link to post
Share on other sites
seandisanti

hoi,hoi all,

i having trouble with a script i was to read 4 field from a file and take though values and write them to another spot the problem is there are lines of junk in between that i need to ignore and in some cases i only want to use one work noth the whole line is there anything i can can do to do this if you can please help

thank you

Frankie PAul

that is called parsing, just so you know, and it can be done very easily with the string manipulation functions in AutoIT. in the help file, go to the index tab, and just type string. you'll see alot of string functions to use parsing your data. also, because some level of parsing is needed in almost any I/O operations for data that is beyond the scripts control, you can find alot of examples of string manipulation and parsing in posts on this forum.

Share this post


Link to post
Share on other sites
Frankie Paul

I believe this "one-liner" contains 2 questions:

1. yes

2. post what you have.

ok

test.au3


ƒrankie Paul

Share this post


Link to post
Share on other sites
Jos

something like this ?

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop

    Select
        Case StringLeft($line, 2) = "//"
        ;
        Case StringLeft($line, 4) = "Id = "
        ;
    EndSelect
WEnd

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

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  

×