Sign in to follow this  
Followers 0
Just_Plain_Cool

Help with FileReadLine()

3 posts in this topic

Hi All...

I have written a script in AutoIt that reads in a date/time string from a file and then when that time comes, launches a program. I then wrote a VB app to create and manage the file containing the dates and times.

When I created the schedule file by hand, it was simply a text file. Each line contained:

MM/DD/YY HH:MM

With this format, everything works fine.

However, when VB saves out strings to a text file, it outputs them with quotation marks around them:

"MM/DD/YY HH:MM"

With the quotes, FileReadLine() is setting @error to -1.

I could read the file in one byte at a time, adding each character to a string and discarding the quotation marks. When this routine came to a CR/LF, it would start another string. I'm sure this would work, but I was hoping for a more elegant/less time consuming answer...

Any takers???

Thanks in advance,

JPC :ph34r:

Share this post


Link to post
Share on other sites



working fine here?

$handle = FileOpen("test.txt", 0)
$var1 = FileReadLine($handle)
$var2 = FileReadLine($handle)
MsgBox(0,'', $var1 & $var2)
FileClose($handle)

test.txt contains:

"MM/DD/YY HH:MM"

"11/25/80 12:00"

he reads it just fine and puts it in msgbox.

maybe you have mispelled something?

it would be useful if you post your code.

Greetings,

ZeD

Share this post


Link to post
Share on other sites

working fine here?

$handle = FileOpen("test.txt", 0)
$var1 = FileReadLine($handle)
$var2 = FileReadLine($handle)
MsgBox(0,'', $var1 & $var2)
FileClose($handle)

test.txt contains:

he reads it just fine and puts it in msgbox.

maybe you have mispelled something?

it would be useful if you post your code.

Greetings,

ZeD

<{POST_SNAPBACK}>

Hi ZeD,

Upon hearing that it was working on your end, I went about trying to figure it out here. As is usually the case when I spend too much time trying to track down a bug, it was something simple. I had made an error when I changed how I am parsing the string to compare it to today's date. Gee, you mean "09/20/0 is not the same as 09/20/04? :ph34r:

Thank you for your help,

JPC :(

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