! RETURN.BAS   Types return address labels  2/10/80   ske

MAP1 PRINTER'NAME,S,15
MAP1 STUFF(5),S,28

? TAB(-1,0); TAB(5,10); "RETURN ADDRESS PRINTER"

LOOKUP "HANDLE.DAT",NAME'THERE
       IF NAME'THERE <= 0 THEN GOTO NO'NAME

Open #99, "HANDLE", INPUT
       INPUT LINE #99, PRINTER'NAME
       CLOSE #99

? TAB(10,10);
INPUT LINE "Do you need instructions? ", A$
       IF UCS(A$[1,1]) = "Y" THEN GOSUB INSTRUCTIONS

GOSUB OPEN'1

GET'THE'STUFF:
       FOR N = 1 TO 5
               ? TAB(16+N,15);
               ? "LINE #";N;": ";
               INPUT LINE "", STUFF(N)
               IF LEN(STUFF(N)) > 28 THEN GOSUB TOO'LONG
               NEXT N

CORRECT'ERRORS:
       A$ = ""
       ? TAB(23,1);
       INPUT "Would you like to change anything? ", A$
       IF UCS(A$[1,1]) = "Y" THEN GOSUB MAKE'CHANGES

HOW'MANY:
       COUNTER = 0
       A$ = ""
       ? TAB(-1,0); TAB(10,10);
       INPUT "How many labels would you like to print? ", COUNTER
       IF COUNTER < 1 THEN GOTO HOW'MANY
       IF INT(COUNTER/4) = COUNTER/4 THEN GOTO LINE'UP'PRINTER
       ? : ? "There are four labels to a line, so I'll just round up"
       ? "to"; (INT(COUNTER/4) + 1) * 4 ;"labels if you don't mind."

LINE'UP'PRINTER:
       A$ = ""
       ? : ?
       ? "You should now put the labels into the printer."
       INPUT LINE "Hit RETURN when you're ready to begin >",A$
       ? #1, "This should be the top line";
       CLOSE #1
       INPUT LINE "Hit RETURN when the printer is set to the top line ", A$
       GOSUB OPEN'1
       ? #1 : ? #1 : ? #1 : ? #1
       ? #1, TAB(102);"This should be the last label";
       CLOSE #1
       ?
       INPUT LINE "Hit RETURN then the printer is lined up ", A$

PRINT'THE'LABELS:
       GOSUB OPEN'1
       ? #1 : ? #1
       FOR N = 1 TO COUNTER/4
               FOR J = 1 TO 5
                       FOR K = 1 TO 4
                               ? #1, TAB((K-1) * 34); STUFF(J);
                       NEXT K
                       ? #1
               NEXT J
               ? #1
       NEXT N

CLEANUP:
       A$ = ""
       ? TAB(-1,0); TAB(10,10);
       INPUT LINE "Would you line to do some more? ", A$
       IF UCS(A$[1,1]) = "Y" THEN GOTO GET'THE'STUFF

QUIT:
       CLOSE #1
       END

INSTRUCTIONS:
       ? TAB(-1,0); TAB(10,10);
       ? "This program prints out return labels for you."
       ? TAB(11,15); "You enter the information you wish to have on the"
       ? TAB(12,15); "five lines of the label, (there's a maximum of 28"
       ? TAB(13,15); "characters per line) and then tell the program how"
       ? TAB(14,15); "many labels you wish to print.  You will have to"
       ? TAB(15,15); "load labels onto the printer and hit RETURN a"
       ? TAB(16,15); "couple of times after adjusting the labels before"
       ? TAB(17,15); "the printer starts the labels.  Be sure to tell"
       ? TAB(18,15); "the program that you are through before you take the"
       ? TAB(19,15); "labels out of the printer. It might have a couple of"
       ? TAB(20,15); "labels left inside waiting to be printed if you don't."
       ? tab(22,10);
       INPUT LINE "Hit RETURN to begin >", A$
       ? TAB(-1,0)
       RETURN

TOO'LONG:
       ? TAB(22,1); "Sorry, but you are limited to 28 characters per line."
       INPUT LINE "Hit RETURN to try again >", A$
       ? TAB(22,1); TAB(-1,9)
       ? TAB(23,1); TAB(-1,9)
       ? TAB(16+N,1); TAB(-1,9)
       N = N - 1
       RETURN

MAKE'CHANGES:
       A$ = 0
       ? TAB(23,1); TAB(-1,9); TAB(23,10);
       INPUT "Which line would you like to change? ", N
       IF N < 1 OR N > 5 THEN GOTO MAKE'CHANGES
       ? TAB(16+N,1); TAB(-1,9); TAB(16+N,15);
       ? "LINE #";N;": ";
       INPUT "", STUFF(N)
       IF LEN(STUFF) > 28 THEN GOSUB TOO'LONG
       ? TAB(23,10); TAB(-1,9);
       INPUT "More changes? ", A$
       IF UCS(A$[1,1]) = "Y" THEN GOTO MAKE'CHANGES
       RETURN

OPEN'1:
       OPEN #1, PRINTER'NAME, OUTPUT
       RETURN

NO'NAME:
       ? TAB(10,10); "Sorry, but before you can run this program, you"
       ? TAB(11,10); "should run the program called HARD to initialize"
       ? TAB(12,10); "the name of your printer.     Over & out."
       END

! **************************  THE END   ********************************