home *** CD-ROM | disk | FTP | other *** search
- $compile EXE
- $ERROR ALL OFF
- $OPTION CNTLBREAK OFF
- $SOUND 0
- $LIB ALL OFF
- $LIB LPT ON
- ' barcode printing
- ' losely based on a program in another language by an unknown author
-
- '-=-=- - SPECIFICATIONS - -=-=-
- '-= =-
- '-= W N =-
- '-= | Nominal Width | Nominal Width | Nominal Ratio =-
- '-= Density | of | of | of =-
- '-= (Characters/ | Narrow Bars and | Wide Bars and | Wide to Narrow =-
- '-= Inch) | Spaces (Inches) | Spaces (Inches)| Element Width =-
- '-= -------------+-----------------+----------------+---------------- =-
- '-= 5.730 | 0.0125 | 0.0315 | 2.52 =-
- '-= -------------+-----------------+----------------+---------------- =-
- '-= =-
- '-=-=- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=-=-
- '-=-=- Code 3-of-9 was developed in 1974 by Dr. David C. Allais of -=-=-
- '-=-=- Interface Mechanisms, Inc. It is the most widely used -=-=-
- '-=-=- alphanumeric bar code in use. Code 3 of 9 is called this -=-=-
- '-=-=- because the original concept provided for 39 data characters. -=-=-
- '-=-=- The name also describes what has become the general meaning -=-=-
- '-=-=- of the phrase, the structure of the code which has 3 wide -=-=-
- '-=-=- elements out of a total of 9. -=-=-
- '-=-=- -=-=-
- '-=-=- The height should be an exen number and approx 15% of the -=-=-
- '-=-=- total code length -=-=-
- '-=-=- -=-=-
- '-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- DEFINT a-z
- $INCLUDE "pbwindow.inc"
-
- Bar0to2Off% = 0
- Public frc,brc,NarrowSpace$,WideSpace$,NarrowBar$,WideBar$,PrintHead$()
- DIM PrintHead$(30)
-
- '*====================*
-
- SUB MakeBlankScreen
- ' this makes the blank window that all others will print in
- IF IsColr THEN
- frc = 7
- brc = 1
- ELSE
- frc = 7
- brc = 0
- END IF
- CALL makeBox(1,27,6,27,frc,brc,2,0,0,-1,-1)
- CALL BoxTitle(2,"3 of 9",-1,-1)
- CALL BoxTitle(5,"Bar Codes",-1,-1)
- END SUB
-
- '*====================*
-
-
- SUB MainMenu(lastItm)
- SHARED itm
- mList$(1) = "Print Data from CONSOLE"
- mlist$(2) = "Print Data from FILE"
- mlist$(3) = "ADD Data to FILE"
- mlist$(4) = "Quit"
- mlist$(5) = ""
- IF IsColr THEN
- CALL BuildMenu(itm,LastItm,0,0,-1,-1,14,4,2,mlist$(),0,4)
- ELSE
- CALL BuildMenu(itm,LastItm,0,0,7,0,15,7,2,mlist$(),0,-1)
- END IF
- END SUB
-
- '*====================*
-
-
- SUB ClearWindow
- FOR x = 1 TO 4
- CALL PrtEol(x,1)
- NEXT
- END SUB
-
- SUB EnterData
- SHARED msg$,hmsg$
-
- msg$=""
- hmsg$=""
- CALL ClearWindow
- CALL CtrBox(1,"Enter Message")
- CALL PrtBox(2,1,STRING$(25,CHR$(219)))
- FOR x = 1 TO 25
- CALL PrtAttrBox(2,x,CHR$(219),15+16,7)
- WHILE NOT INSTAT:WEND
- ms$ = INKEY$
- IF ms$=CHR$(13) THEN EXIT FOR
- CALL PrtBox(2,x,ms$)
- msg$=msg$+UCASE$(ms$)
- NEXT
- msg$ = "*"+msg$+"*"
- CALL ClearWindow
- hmsg$=GetHeight$
- CALL ClearWindow
- END SUB
-
- '*====================*
-
-
- SUB InitializePrintHead
- WideSpace$ = CHR$(0,0,0,0)
- NarrowSpace$ = CHR$(0,0)
- WideBar$ = CHR$(255,255,255)
- NarrowBar$ = CHR$(255)
- END SUB
-
-
- '*====================*
-
- SUB FillPrintHead(message$)
-
- 'send in message
- FOR x = 1 TO LEN(message$)
- SELECT CASE MID$(message$,x,1)
- CASE "1"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "2"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "3"
- Bar$=WideBar$+NarrowSpace$+WideBar$+WideSpace$+NarrowBar$+_
- NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "4"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "5"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+WideBar$+_
- NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "6"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+WideBar$+_
- NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "7"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+WideBar$
- CASE "8"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "9"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "0"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- WideBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "A"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "B"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "C"
- Bar$=WideBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "D"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "E"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "F"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "G"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+WideBar$
- CASE "H"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "I"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "J"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+WideSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "K"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+WideBar$
- CASE "L"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+WideBar$
- CASE "M"
- Bar$=WideBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+NarrowBar$
- CASE "N"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+WideBar$
- CASE "O"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+NarrowBar$
- CASE "P"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+WideSpace$+NarrowBar$
- CASE "Q"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+WideBar$
- CASE "R"
- Bar$=WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+NarrowBar$
- CASE "S"
- Bar$=NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+WideSpace$+NarrowBar$
- CASE "T"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+WideBar$+WideSpace$+NarrowBar$
- CASE "U"
- Bar$=WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "V"
- Bar$=NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "W"
- Bar$=WideBar$+WideSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "X"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+WideBar$
- CASE "Y"
- Bar$=WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "Z"
- Bar$=NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "-"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+WideBar$
- CASE "."
- Bar$=WideBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE " "
- Bar$=NarrowBar$+WideSpace$+WideBar$+NarrowSpace$+_
- NarrowBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
- CASE "*"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- WideBar$+NarrowSpace$+WideBar$+NarrowSpace$+NarrowBar$
-
- CASE "$"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+NarrowBar$
- CASE "/"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+NarrowBar$
- CASE "+"
- Bar$=NarrowBar$+WideSpace$+NarrowBar$+NarrowSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+WideSpace$+NarrowBar$
- CASE "%"
- Bar$=NarrowBar$+NarrowSpace$+NarrowBar$+WideSpace$+_
- NarrowBar$+WideSpace$+NarrowBar$+WideSpace$+NarrowBar$
- END SELECT
- PrintHead$(x)=Bar$
- NEXT
- END SUB
-
-
- '*====================*
-
- SUB PrintData
- SHARED hmsg$,msg$
- LOCAL Temp$(),English$()
- DIM DYNAMIC English$(30)
- FOR x = 1 TO LEN(msg$)
- English$(x) = MID$(msg$,x,1)
- IF (x <> 15) AND (x <> 25) THEN
- IF x>2 AND (x MOD 2) > 0 THEN English$=English$+" "
- END IF
- NEXT
-
- WIDTH "LPT1:",255'disable line feeds
- LPRINT CHR$(27,51,2);
-
- 'get vals for dot graphics command
- Columns = 21
- n1 = columns MOD 256
- n2 = columns\256
-
- CALL ClearWindow
- CALL PrtBox(1,1,"Printing ")
- height = ABS(VAL(hmsg$))
- IF height <2 THEN height =2
- FOR h = 1 TO height
- FOR n = LEN(msg$) TO 1 STEP -1
- CALL prtBox(2,1+n," ")
- NEXT
- FOR m = 1 TO LEN(msg$)
- CALL PrtBox(2,m,English$(m))
- LPRINT CHR$(27,76,n1,n2);printhead$(m);narrowspace$;
- NEXT
-
- IF (h MOD 2) = 0 THEN LPRINT CHR$(27,74,19);
- LPRINT
- CALL PrtBox(3,1,"Pass" + STR$(h) + " complete")
- NEXT h
-
- 'reset printer
- LPRINT CHR$(27);"@"
- LPRINT English$;msg$
- LPRINT
-
- ERASE English$
-
- END SUB
-
-
- '*====================*
-
- SUB LoadFromDisk
- SHARED message$,hmsg$
- CALL ClearWindow
- hmsg$=GetHeight$
- CALL ClearWindow
- OPEN "BarCode.Dat" FOR INPUT AS # 1
- WHILE NOT EOF(1)
- INPUT #1,msg$
- msg$="*"+msg$+"*"
- WEND
- CLOSE #1
- END SUB
-
- '*====================*
-
-
- SUB WriteToDisk
- SHARED msg$
- OPEN "BarCode.dat" FOR APPEND AS #1
- DO
- msg$=""
- CALL ClearWindow
- CALL CtrBox(1,"Enter Message")
- CALL PrtBox(2,1,STRING$(25,CHR$(219)))
- FOR x = 1 TO 25
- CALL PrtAttrBox(2,x,CHR$(219),15+16,7)
- WHILE NOT INSTAT:WEND
- ms$ = INKEY$
- IF ms$=CHR$(13) THEN EXIT FOR
- CALL PrtBox(2,x,ms$)
- msg$=msg$+UCASE$(ms$)
- NEXT
- IF msg$="" THEN EXIT LOOP
- msg$ = "*"+msg$+"*"
- PRINT #1,msg$
- CALL ClearWindow
- LOOP
- CALL ClearWindow
- CLOSE 1
- END SUB
-
- '*====================*
-
-
- FUNCTION GetHeight$
- CALL CtrBox(1,"Enter Height")
- Spot = (PBWW(1)/2) -1
- CALL PrtBox(2,Spot+1,STRING$(2,CHR$(219)))
- FOR x = 1 TO 2
- CALL PrtAttrBox(2,Spot+x,CHR$(219),15+16,7)
- WHILE NOT INSTAT:WEND
- ms$ = INKEY$
- IF ms$=CHR$(13) THEN EXIT FOR
- CALL PrtBox(2,spot+x,ms$)
- hmsg$=hmsg$+ms$
- NEXT
- ' make it an even number
- ht = VAL(hmsg$)
- IF ht MOD 2 <> 0 THEN INCR ht
- GETHEIGHT$ = MID$(STR$(ht),2)
-
- END Function
-
- '*====================*
-
-
-
-
- CLS'later change to a save the entire window and then cls and restore at end
-
- CALL MakeBlankScreen
- CALL InitializePrintHead
- ItmNum = 1
- DO
- CALL MainMenu(itmNum)
- SELECT CASE itm
- CASE 1
- CALL EnterData
- CALL FillPrintHead(msg$)
- CALL PrintData
- CASE 2
- CALL LoadFromDisk
- CALL FillPrintHead(msg$)
- CALL PrintData
- CASE 3
- CALL WriteToDisk
- CASE 4
- CLS
- END (0)
- CALL ClearWindow
- CALL removeBox
- END SELECT
- ItmNum = Itm
- Itm = 0
- LOOP
-