Microsoft Small Basic

Program Listing: ZFG729
' 25 Line Easy Barcode Code39 Maker // without start/end code , checkdigit by NaochanON
' you can use these characters....... 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-._$/+%*

base="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-._$/+%*" ' Note space --> " _"
TextWindow.WriteLine("Enter number to make a barcode. you can use these characters... "+base+" ...")
EntNMB=text.ConvertToUpperCase(TextWindow.Read())
bars="0=000110100;1=100100001;2=001100001;3=101100000;4=000110001;5=100110000;6=001110000;7=000100101;8=100100100;9=001100100;A=100001001;B=001001001;C=101001000;D=000011001;E=100011000;F=001011000;G=000001101;H=100001100;I=001001100;J=000011100;"
bars=bars+"K=100000011;L=001000011;M=101000010;N=000010011;O=100010010;P=001010010;Q=000000111;R=100000110;S=001000110;T=000010110;U=110000001;V=011000001;W=111000000;X=010010001;Y=110010000;Z=011010000;-=010000101;.=110000100;_=011000100;$=010101000;"
bars=bars+"/=010100010;+=010001010;%=000101010;*=010010100"
BLTH="L=20;T=50;H=100" ' Left=20 Top=50 Height=100
BW="0=2;1=3" ' Narrow width=2+3*0=2 // Wide width= 2+3*1=5
sum=0
GraphicsWindow.brushColor="black"
For i=1 To Text.GetLength(EntNMB)
GraphicsWindow.DrawText(BLTH["L"]+sum+10,BLTH["T"]+BLTH["H"],Text.GetSubText(EntNMB,i,1))
char=bars[Text.GetSubText(EntNMB,i,1)] ' a character
For j=1 To 9
ItNMB= text.GetSubText( char,j,1) ' 0 or 1
barwidth=Math.Remainder(ItNMB,2)*BW[1]+BW[0] ' 0; 2+3*0=2 1;2+3*1=5 // Ratio width[ 1 ]/width[ 0 ] = 2.5
sum=sum+ barwidth ' black bar position
If math.Remainder(j,2)=1 and ItNMB=0 then ' odd number ...... 1,3,5,7,9 & 0
GraphicsWindow.FillRectangle(BLTH["L"]+sum-barwidth,BLTH["T"],BW[0],BLTH["H"])
Elseif math.Remainder(j,2)=1 and ItNMB=1 then ' odd number ...... 1,3,5,7,9 & 1
GraphicsWindow.FillRectangle(BLTH["L"]+sum-barwidth,BLTH["T"],(BW[1]+BW[0]),BLTH["H"])
EndIf
endfor
sum=sum+BW[0] ' add a space
EndFor