Jump to content

Send problems with filereadline...


Recommended Posts

**Edit** Sorry if this has been posted before, but I looked through 4 pages of info about FileReadLine and didn't see anything that addressed this. Please help if you can! Thanks.

I'm trying to read data from a file, and send the data to another program, but it only sends the very first line of data. It doesn't ever go to the next line...

Here's what I have..help is greatly appreciated! :(

$file = FileOpen("c:\list.txt", 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

While 1

If @error = -1 Then ExitLoop

$line = FileReadLine($file)

send($line)

Wend

FileClose($file)

Edited by andy5179
Link to comment
Share on other sites

Try this out. Might want to add a pause though.

$file = Fileread("c:\list.txt", filegetsize("c:\list.txt"))
$fileline=StringSplit(StringReplace($file,@lf,""),@cr)

for $i=1 to $fileline[0]
send($fileline[$i])
; send(@crlf) 
; uncomment send line above if you want returns
next

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Try this out. Might want to add a pause though.

$file = Fileread("c:\list.txt", filegetsize("c:\list.txt"))
$fileline=StringSplit(StringReplace($file,@lf,""),@cr)

for $i=1 to $fileline[0]
send($fileline[$i])
; send(@crlf) 
; uncomment send line above if you want returns
next

<{POST_SNAPBACK}>

I added the pause and it worked perfectly. You are a godsend! Thank you so much!
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...