Limited text characters

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
knotobvious

Limited text characters

Post by knotobvious » Mon Mar 01, 2004 6:47 pm

I have an application that will accept only 30 characters of text per line. It is a very cumbersome application to use so I would like to use something like Notepad to build the text file and then send line by line to the other application.
I know if you use Notepad with word wrap turned on, long lines will wrap to the window and appear as multiple lines even though it is one continous line.
I have set up a "Dialog>" in Macro Scheduler using "Memo" and have had the same results as when using Notepad.
What I would like to do is to only allow each line to build up to 30 characters and then have a CRLF return the cursor to the next line. Also I dont want to cut off a word in mid-stream, meaning that if the word is too long to fit on the current line then the whole word will move to the next line.

Does anybody have any suggestions?

Lumumba

Post by Lumumba » Mon Mar 01, 2004 7:50 pm

Let>Line=01234 56789 01234 56789 01234 5789 01234 56789 01234 56789 01234 56789 01234 56789

-----

Let>space=
Let>LineLength=0

Separate>Line,%space%,word
MessageModal>Num words: %word_count%

Let>k=0
Let>WLN
Repeat>k
Let>k=k+1
Length>word_%k%,wl
Let>LineLength=%LineLength%+%wl%
Add>LineLength, 1
If>LineLength>30, EOL
MessageModal>Word: word_%k%%CRLF%NumChar/Line: LineLength%
WriteLn>c:\temp\test.txt,result, word_%k%
Until>k,word_count
Goto>End

Label>EOL
Let>LineLength=%wl%
WriteLn>c:\temp\test.txt,result,%CRLF%word_%k%
Goto>WLN

Label>End

-----

Sorry can't test it. Just an idea :idea:

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