Format Your Words With This TEXT Aid

From Bitchin100 DocGarden
Revision as of 12:39, 25 January 2009 by 97.89.182.164 (talk)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

With a little Basic help, your 100 can be a hot-shot word processor. By RICHARD RAMELLA Portable 100/September 1983 Page 27-28 ____ Though its text-handling capabilities are diverse, the Model 100's built-in, word-processing program lacks features needed by many wordsmiths. So I wrote TEXTHELPER, a fairly short basic program that formats printed documents in useful ways.

With this program, you may set side margins from 0 to 20, single-, double- or triple-space, and print page numbers, headers, and footers. The text is automatically printed in a spaced format so it continues from page to page with uniform margins at top and bottom. It is for use with standard 8 l/z-by-11 -inch paper.

And just to show you my heart's in the right place, I've thrown in a little routine that counts the words in a document.

FASTER THAN HAND. The format printing process occurs quite slowly by computer standards but still is perhaps 10 times faster than the human hand and unerring in following your instructions. Sophisticated and lightning quick word processing is on the horizon for the Model 100, but those programs you won't get for the cost of a few magazine pages.

The experts may want to skip ahead here, because I'm starting at the beginning for the many Model 100 owners just getting acquainted with their machine.

The Model 100 has several kinds of files. The two we'll deal with are text documents and Basic programs. The program TEXTHELPER is a Basic program. It calls up material in a text file and sends it to the line printer, which prints it on paper in the format you have determined.

What you need to know about creating a text file is in chapter eight (pages 43-60) of the manual that came with the computer. Once you are able to create a text file, write words in it, and save the file, you can use this program.

MENU MODE, In the menu mode, the text file you create will be followed by the file name extension .DO. Using TEXTHELPER, you may call up only .DO files for formatting.

Before you Run TEXTHELPER, there, must be a text file in the system, and you must know the exact name of it. This isn't difficult because you named the file when you created it.

A note of caution is warranted here. When you create the text file, make sure you don't use the tab key on your 100. And although your typing teacher may have taught you to leave two spaces between sentences, don't do it here. The results will be bizarre.

Let's say you want to format a file listed in the menu as MOM.DO. (It's a long overdue letter to your poor old gray-haired mother.)

This program is so user-friendly many experienced computer jockeys are going co be kicking out program lines left and right. But it protects the novice computer user from mistakes in numerous ways.

As the program begins, a two-item menu is shown. Type 1 and tap enter to try the word counter. Or type 2 and tap enter to try the document formatter. Tap anything else and you must try again until you get one of the two acceptable answers.

WORD COUNTER. If you try the word-counter routine, it asks for the name of the file to be accessed. The file name is MOM.DO, but you just type in the word MOM in any mix of upper and lower case, and the machine understands. The program displays WORDS: followed by a number that grows as each word is counted. When it's through counting, you know it because you're told Tap "M" to return to "MENU."

The document formatting pan of the program is more complex in its workings but not complex in use.

DECISIONS, DECISIONS. To format, you must make several decisions. I'll list them in turn: • You're asked what margin from 0 to 20 you wish. A choice less than zero or more than 20 is unacceptable. Paper sized at 8 1/2-by-ll inches will hold about 85 characters on a line. Note that 9 1/2-by-11-inch computer paper is actually 8 1/2 inches wide after you tear off the tractor-feed margins. If your line printer allows changing the width of letters, I advise you to set it at 10 characters per inch so 85 characters fit snugly between one edge and the other. Otherwise, this program may give you unintended results.

The number you choose for a left margin is exact but on the right it is approximate. Both are about the same, but the right margin allows a bit of grace. This is because the program doesn't go to the next line until it encounters a line feed or blank space occurring after passing the line length determined by the margins it passed. This prevents line feeds in mid-word.

• That brings us to the next choice. If you select a right margin of 10 and a left margin of 10, then you'll have a line with about 65 characters (85 minus 20) in it. The program tells you this and asks: "Is this okay?" If it isn't, type N for no and tap Enter.

You'll get another try at setting margins and may keep trying until satis­fied. Answering Y for yes sends the program onward. • A menu for line spacing is shown. Your choices are 1 for single space. 2 for double space, and 3 for triple space. If you are printing a single-spaced document on a single page, it's better to use the print function included with the Model 100's text-processing program. Single-spaced text gives you 50 lines a page, double-spaced 25 lines, and triple-spaced 16 lines.

• Now choose your header. A header is just word-processing jargon for a title. You don't need a header on a letter to mom, but in other cases it's very useful: War and Peace — Fifth Draft... Annual Re­port... and the like. You are given a limit here for the number of characters you may put in the header. It's based on the number of characters in the formatted line. If your header is too long, you get a chance to write a shorter one. In fact, it's mandatory.

The header also includes three other interesting things: the date, the time, and the page number. These are provided automatically. I'm afraid that by including the exact time on each page, I've re­vealed exactly how slow this pro­gram can be - more than two min­utes for a double-spaced page 65 characters wide.

• The final format choice is the footer. It goes below the final line on the page and approximately flush with the right of that line. A footer may say (MORE), (CONTINUED) or any other message you want on each page. Don't make It too long; if it is longer than the number of characters in your line, you may get an error message and a crashed program. Trusting you to follow this advice, I have not built in a rescue should your footer exceed the number of characters in the line.

GENTLE REMINDER. Now the program reminds you to turn on the printer and position the paper. On my ancient Line Printer III the paper is positioned if the top of the print head is even with the perforation across the top of the first fan-fold page on which I will he printing.

You may have to experiment for the best setting on your printer.On the same screen display as your final reminders are the words: "Enter name of text file to be formatted." In our hypothetical case, we type the word "mom" and stand back for some turtle-like formatted printing.

If your printer doesn't jam the first time you look away from it, you might go into the kitchen for milk and cookies while it does its work. You can get pretty bored watching this program run - even when it's printing your own deathless words.

100 REM*TEXTHELPER*
101 REM*TRS-80 Model 100*
102 REM*By Richard Romella*
110 CLS
120 PRINT"Menu:"
130 PRINT STRING$(24,"-")
140 PRINT"1-Word Counter"
160 PRINT"2-DocumentFormatter"
170 PRINT STRING$(24,"-")
180 INPUT"Number of your choice";A
190 IF A<>1 AND A<>2 THEN CLS:PRINT"Choiceslimitedlo...":GOTO 120 
200 CLS:H=0:P=0
210 IF A=2 THEN 340 
220 REM*WordCountRoutine*
230 W=1
240 INPUT “Name of file for word count";N$
250 OPEN N$ FOR INPUT AS 1 
260 A$=INPUT$(1,1) 
270 Z$=Z$+A$ 
280 N=N+1
290 IF N>3 THEN Z$=RIGHT$(Z$,3) 
300 IF EOF(1) THEN 780
310 IF A$=CHR$(10) THEN W=W+1
311 IF LEFT$(Z$,1)<>CHR$(32) AND MID$(Z$,2,1)=CHR$(32) AND RIGHT$(Z$,1)<>CHR$[32)THEN W=W+1 
320 PRINT @165,”WORDS:”;W 
330 GOTO 260
340 REM* Document Formatter * 
350 INPUT”Margin width (0 to 20)”;M 
360 IF M<0 OR M>20 THEN CLS: PRINT "Note limits”: GOTO 350 ELSE M=INT(M):CLS
370 WL=85-{M*2) 
380 PRINT"Margins of”M"left and right yield" 
390 PRINT”a line of about ”WL” characters.” 
400 INPUT”Is this okay(y/n)”;G$ 
410 IF G$<>”y” AND G$<>"Y" AND G$<>”n” AND G$<>”N" THEN CLS:GOTO 380 
420 IF G$-"n" OR G$-"N"THEN CLS:GOTO 350 ELSE CLS 
430 PRINT "Spacing:"  
440 PRINT STRING$(15,"-”) 
450 PRiNT”1-single” 
460 PrlNT”2-double"
470 PRINT”3-triple" 
480 PRINTSTRING$(15,"-") 
490 INPUT”Choose 1, 2or 3”;SP 
500 IF SP<>1 AND SP<>2 AND SP<>3 THEN CLS:GOTO 430 ELSE CLS 
510 PRINT”Header up to”WL-19"characters”
520 INPUT”Header choice";HE$ 
530 IF LEN(HE$)>WL-19 THEN CLS:PRINT HE$:PRINT”too long.”:PRINT:GOTO510 
540 CLS
550 INPUT”Footer choice”;FO$ 
560 CLS 5
570 PRINT”Line printer on? Paper positioned?"
580 PRINT”Enter name of text file to be formated." 
590 INPUT N$ 
600 P=1
610 FOR A=1 TO 4 
620 LPRINT
630 NEXT
640 XX=1
650 GOSUB 880
660 LPRINT
670 LPRINT
680 OPEN N$ FOR INPUT AS 1
690 LPRINT SPACE$(M);
700 A$=INPUT$(1,1)
710 IF EOF(1) THEN PRINT”Document has been printed in chosen format.":GOTO 780
720 LPRINT A$; 
730 H=H+1 
740 IF H>WL AND A$=CHR$(32) THEN FOR=1 TO SP:LPRINT:J=J+1:NEXT V:LPRINT SPACE$(M);:H=0 
750 IF A$=CHR$(10) AND SP>1 THEN J=J+1:FOR V=1 TO SP-1:LPRINT:J=J+1:NEXT V:LPRINT SPACE$(M);:H=0:ELSE IF A$=CHR$(10)THEN J=J+1:H=0:LPRINT SPACE$(M); 
760 IF SP-1 AND J-50 OR SP-2 AND J-50 OR SP=3 AND J=48 THEN GOSUB 810 
770 GOTO 700
780 CLOSE 1 
790 PRINT@240,"Tap M to return to MENU"
800 IF INKEY$=”” THEN 790 ELSE 110 
810 LPRINT 
820 LPRINT 
830 LPRINT SPACE$(85-(M+LEN(FO$))),FO$ 
840 FOR S=1 TO 8 
850 LPRINT 
860 NEXTS 
870 IF SP=3 THEN LPRINT:LPRINT 
880 J=00:IF XX=0 THEN P=P+1 
890 LPRINT SPACE$(M);CHR$(32);HE$;CHR$(32);CHR$(32);DATE$,CHR$(32);TIME$;SPACE$(3);P 
900 LG=LEN(HE$+CHR$(32)+DATE$+CHR$(32)+TIME$;SPACE$(7))
910 LPRINT SPACE$(M);STRING$(LG,"-") 
920 IF XX=1 THEN XX=0:RETURN
930 FOR S=1 TO 3 
940 LPRINT 
950 NEXTS
960 LPRINT SPACE$(M); 
970 RETURN 
980 END