Sign in to follow this  
Followers 0
dkwokgs

How to use FileReadToArray to read a txt file?

3 posts in this topic

Hi there,

I am new to array. I am trying to read a txt and extract first line and all line after "Application:" (see attached) in to another txt file and then import in excel. There are thousands of same type of file generate from psinfo for indiviual machine on the network. Is there a good example of how to use? Please advise.

Tried reading the file.au3 but still cannot figure out.

Psinfo --> http://www.sysinternals.com/ntw2k/freeware/psinfo.shtml

Thanks

Daniel

123.txt

Share this post


Link to post
Share on other sites



You can try this, at least it might point you in a direction.

$file="123.txt"
$x=Stringsplit(StringReplace(FileRead($file,FileGetSize($file)),@lf,""),@cr)

$start=0
for $i=1 to $x[0]
if $start=1 then msgbox(1,"",$x[$i])
if StringLeft($x[$i],13)="Applications:" then $start=1
next

$x[] is the array, I have it mark $start when it finds your first word.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks man

You can try this, at least it might point you in a direction.

$file="123.txt"
$x=Stringsplit(StringReplace(FileRead($file,FileGetSize($file)),@lf,""),@cr)

$start=0
for $i=1 to $x[0]
if $start=1 then msgbox(1,"",$x[$i])
if StringLeft($x[$i],13)="Applications:" then $start=1
next

$x[] is the array, I have it mark $start when it finds your first word.

<{POST_SNAPBACK}>

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