by COBS Tech Support » Thu Dec 08, 2005 9:12 am
That depends on exactly what you want to do with the printer. If you want to use it in a very generic way to handle a variety of different printing tasks, this may be possible in theory but impractical in reality. If you want to use it for a number of specific (dedicated) tasks, then should be possible.
Below is a script created for the Eltron label printer which sends data directly to its LPT port. This label printer has a programming language designed for DOS style applications. This script emulates DOS usage through Windows:
* Test Eltron Label 2
Declare cr Type Character
cr := CHR(10)
PutPort('LPT1', CR, 1)
PutPort('LPT1', 'N' + cr, 1)
PutPort('LPT1', 'R465,0' + cr, 1)
PutPort('LPT1', 'S4' + cr, 1)
PutPort('LPT1', 'A5,5,0,3,1,2,R," Acme Appl.Service "' + cr, 1)
PutPort('LPT1', 'A10,60,0,2,2,2,N,"' + Alltrim(Stock->Name) + '"' + cr, 1)
PutPort('LPT1', 'A10,100,0,2,1,2,N,"' + Left(Stock->Title, 29)+ '"' + cr, 1)
PutPort('LPT1', 'A10,140,0,2,1,2,N,"' + Substr(Stock->Title, 30, 40)+ '"' + cr, 1)
PutPort('LPT1', 'A10,185,0,3,1,2,N,"BIN : ' + Stock->Bin + '"' + cr, 1)
PutPort('LPT1', 'B10,230,0,3,1,4,75,N,"'+ Alltrim(Stock->Name) + '"' + cr, 1)
PutPort('LPT1', 'A10,345,0,2,2,2,R," 9999 8888 "' + cr, 1)
PutPort('LPT1', 'A10,320,0,2,1,1,N,"' + DTOC(Today()) + ' ' + TIME() + ' ' + Trim(UserName()) + '"' + cr, 1)
PutPort('LPT1', 'P1' + cr, 1)
Some general comments on the above script.
* Name it STOCK1.MAC so it is accessible from your stock records screen under 'Tasks' on your menu.
* You may need a special DLL file from COBS Tech Support if you get a warning message when you try to use the PutPort() function. Not all distributed versions of CAPITAL directly support "PutPort"
* Windows security may prevent this from working--depending on your user security settings. Not all Windows users may be allowed to have their software directly access hardware ports.
* Information may be sent to the printer--particularly older printers--too fast. So in the above script the function Idle() is used to slow things down so the printer can catch up.
Basically you can use the technique above to integrate DOS or 'command language' driven (non-graphic) printers into the CAPITAL environment. In the long run, though, it is better to switch to graphical printers if you have the option.