ReadLn No ##EOF##

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
dleone
Newbie
Posts: 7
Joined: Tue Jan 22, 2008 4:10 am

ReadLn No ##EOF##

Post by dleone » Thu Jan 24, 2008 8:14 am

Hi,
Not to be a pain.

I'm doing a ReadLn and when get past the end of the file my variable is blank instead of ##EOF##

// Set the CurLineNumber past the end of file.
Let>CurLineNumber=10
ReadLn>D:\ResolutionSetup.txt,%CurLineNumber%,strLine
// NOTE: THIS NEVER OCCURS
If>strLine=##EOF##
If>CurLineNumber>1
Let>CurLineNumber=CurLineNumber-1
Message>You are past the Last Valid Setting/Line in the Setup.
ReadLn>D:\\ResolutionSetup.txt,%CurLineNumber%,strLine
Else
Message>No Lines In ResolutionSetup.Txt file.
exit>1
EndIf
EndIf

Message>%strLine%

When I run the above strLine is Blank even in Debug.

Any Ideas.

Thanks,
David

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jan 24, 2008 8:53 am

Perhaps line 10 IS a blank line. Perhaps the end of the file is further on than you think.

What happens if you run this script:

Code: Select all

Let>CurLineNumber=1
Label>loop
  ReadLn>D:\ResolutionSetup.txt,CurLineNumber,strLine 
  If>strLine=##EOF##
     MessageModal>End of file at line: %CurLineNumber%
     Goto>end
  Endif
  Let>CurLineNumber=CurLineNumber+1
Goto>Loop
Label>end
Eventually you should get a message box telling you what line the file ended at
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jan 24, 2008 8:55 am

Try this script also:

Code: Select all

ReadFile>D:\ResolutionSetup.txt,fileData
Separate>fileData,CRLF,fileLines
MessageModal>Number of lines in file %fileLines_count%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

dleone
Newbie
Posts: 7
Joined: Tue Jan 22, 2008 4:10 am

Post by dleone » Thu Jan 24, 2008 5:19 pm

Thank you,
Guess I was just not thinking, I had checked the file 3 times before and was sure I had now blank lines. But I did.
Thanks again.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts