IBM Personal ComputingDonald B. Trivette
There should be a law requiring all photographs to be labeled with the date and content; otherwise, how is one to remember when and where each snapshot was taken? Unfortunately, writing on the back of a photograph is about as much fun as writing on wax paper. Writing on a word processor, on the other hand, is lots of fun—so if we could somehow get our PC to print on the backs of photographs, we just might have something useful. The solution is the BASIC program listed below to print address labels, which stick nicely to almost any surface—including wax paper and photographs. In addition, the program incorporates features to print multiple labels with the same information and to date each label automatically.
The program reads a file named LABELS, which you create using a word processing program or text editor. The file must be in ASCII format, and the length of each line should not exceed the width of a label. The program is designed to use 3-1/2 X 15/16 inch, fanfolded, pressure-sensitive labels that may be purchased in most office-supply stores for about $7 per thousand. This size label holds five 34-character lines of text.
In order to separate one label from another, the program looks for a dash (-) in the first column of the data. If there is a number immediately after the dash, the program will print that many labels with the text that follows. The first line in the file must either be a blank or contain a date that will be appended automatically to each label. The following figure shows an example of a LABELS file.
(July '86) -15 Vacation at Yellowstone - Uncle Eric -6 Family Reunion Miller Park Mayberry, N.C. - Joe and Phyllis - Aunt Mary's house
This file prints 15 labels for the photos taken at Yellowstone, 1 label for Uncle Eric's photo, 6 to be stuck on the backs of the reunion photos, and 1 each for Joe and Phyllis and Aunt Mary's house. The program prints only five lines to a label; lines after the fifth are discarded, but it's up to you to format the length of each line to stay within the label boundary. The program includes a line-up routine to make it easy to get the labels positioned in the printer.
BA 10 REM AF 20 REM Program to print 3 1/2 x 15/16 inch MJ 30 REM labels for the backs of photographs. DD 40 REM First line in LABELS file may either be 0I 50 REM blank or a date. The - sign signals CI 60 REM the end of one label and beginning of DP 70 REM a new one. The -n option (may be used to BN 80 REM print "n" identical labels. Each label DN 90 REM may have a maximum of 34 characters MA 100 REM by 5 lines. PG 110 REM GI 120 KEY OFF:CLS:DIM S$(20) FB 130 X=1:I=1:SW=0:CNT=0 MO 140 OPEN "labels" FOR INPUT AS #1 LJ 150 LINE INPUT #1,DAT$ BI 160 REM Ready printer and align labels DJ 170 REM Print a test label. IP 180 PRINT "Insert labels in printer and press" OD 190 PRINT "any key to continue... " KO 200 A$=INKEY$:IF A$="" THEN 200 DM 210 LPRINT "<<****";SPACE$(6);"Top Line";SPACE$(6);"****>>" PN 220 FOR I=1 TO 5:LPRINT:NEXT I KF 230 PRINT "Is label aligned? (Y/N)" CO 240 A$=INKEY$:IF A$="" THEN 240 BJ 250 IF A$="Y" OR A$="y" THEN 270 ELSE 210 LL 260 REM Read data from file KG 270 IF MID$(A$,1,1)="-" THEN X=ABS(VAL(A$)) IN 280 IF X=0 THEN X=1 BC 290 LINE INPUT #1,B$ PG 300 IF MID$(B$,1,1)="-" THEN GOSUB 360:A$=B$:I=1:GOTO 270 NF 510 S$(I)=B$ JC 320 I=I+1 IE 330 IF EOF(1) THEN GOSUB 360:PRINT:PRINT CNT;" Labels printed":END HD 340 GOTO 290 NM 350 REM Print Label(s) GC 360 IF SW=0 THEN SW=1:RETURN LM 370 I=I-1 JO 380 IF I>5 THEN I=5 MI 390 FOR J=1 TO X IP 400 CNT=CNT+1 DB 410 FOR K=1 TO I-1 JB 420 PRINT S$(K) NP 430 LPRINT S$(K) OG 440 NEXT K FN 450 PRINT S$(I);DAT$ MB 460 LPRINT S$(I);DAT$ LG 470 FOR L=1 TO 5-I MB 480 PRINT SPACE$(4) AB 490 LPRINT SPACE$(4) PJ 500 NEXT L DJ 510 PRINT SPACE$(4) PE 520 LPRINT SPACE$(4) OL 530 NEXT J NJ 540 FOR K=1 TO I FH 550 S$(K)=SPACE$(4) PL 560 NEXT K NN 570 RETURN QP 580 REM End of Labels Program