Read Line

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
MacschedStudent
Junior Coder
Posts: 36
Joined: Fri Oct 12, 2007 5:55 pm
Location: federal way wa
Contact:

Read Line

Post by MacschedStudent » Sun Feb 27, 2011 6:23 am

I'm using macro scheduler Pro 7.4

This is a newbie question so I'm posting it here. when you use the ReadLn function how many bytes does it grab? The reason I ask is because if I do a read line for example:

Let>k=1
ReadLn>%SCRIPT_DIR%\test.txt,k,line
MessageModal>%line%


I'm going to get the entire paragraph unless there is a empty line separating one paragraph from another. I have no problem with it I'm just trying to verify the function.

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

Post by Marcus Tettmar » Sun Feb 27, 2011 8:54 am

It reads one line. The number of bytes will depend on the size of the line. To clarify a line is delimited by a newline character. In DOS this is CRLF. If you look in notepad with wordwrap OFF then you see a list of lines. ReadLn given a number will retrieve one of these full lines. Each one is a different size in bytes.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

MacschedStudent
Junior Coder
Posts: 36
Joined: Fri Oct 12, 2007 5:55 pm
Location: federal way wa
Contact:

Post by MacschedStudent » Sun Feb 27, 2011 3:56 pm

Marcus, let me make sure I understand what u said. If there are no delimiters and the text is composed of several un-delimeted lines (let say 40) and the next CRLF is at the end of those 40 lines then ReadLn is going to see those 40 lines of characters as one sentence. Is this correct?

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

Post by Marcus Tettmar » Sun Feb 27, 2011 4:03 pm

Um. I never thought I'd have to explain what a line in a text file is! So I'm struggling.

Let's say you open a text file in Notepad and it looks like this:

Hello World
Apples and Oranges
The End

That has THREE lines. Line 2 is 18 chars. If it was ansi text it would be 18 bytes.

If you use ReadLn and specify 2 for the line to read it will read in "Apples and Oranges".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

MacschedStudent
Junior Coder
Posts: 36
Joined: Fri Oct 12, 2007 5:55 pm
Location: federal way wa
Contact:

Post by MacschedStudent » Sun Feb 27, 2011 7:40 pm

marcus as I said in my first explanation. I have a paragraph with no CR or LF in about 40 lines of text. When I used ReadLn it reads the entire paragraph. But based on what u have explained, that is normal function. So as I understand it. because you have 40 lines of data (with no Delmeter separations) it grabs the entire paragraph. I hope I'm explaining this right.

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

Post by Marcus Tettmar » Sun Feb 27, 2011 7:45 pm

Open your file in notepad and make sure word wrap is OFF. You should see this paragraph all on one line. Each line appearing in notepad with word wrap off would be as each line read by ReadLn.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

MacschedStudent
Junior Coder
Posts: 36
Joined: Fri Oct 12, 2007 5:55 pm
Location: federal way wa
Contact:

Post by MacschedStudent » Sun Feb 27, 2011 8:01 pm

Thank u marcus, I did just that, Thanks for confirming and answering my question. And thank u for your patience.

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