LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
on mouseUp
open driver "C:\Windows\system32\DRIVERS\usbprint.sys" for binary write
write numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250) to driver "C:\Windows\System32\DRIVERS\usbprint.sys"
end mouseUp
on mouseUp
put numToByte(27)&numToByte(112)&numToByte(48)& \
numToByte(25)&numToByte(250) into myStr
put "usbprint" into DRVR -- this is presumably the driver name
open driver DRVR for binary write
put the result into nfo
write myStr to driver DRVR
put cr & the result after nfo
close driver DRVR
put cr & the result after nfo
put nfo
on mouseUp
If the result is always empty then there should be some action going on.
Perhaps one of the Win cracks comes in here to tell us more en detail.
yes the result is empty. nothing happened though. I tried to put the full path to the printers driver file and i got the file not able to open error thing again
I don't know what jiggery pokery you might need to get this to work, I've got nothing suitable to test with, but...
I could guess that you could share the POS printer on your PC and then with a command prompt type
or pick a suitable LPT number if LPT1 is in use. Then try opening the LPT1 driver for write and sending the numtobyte construction of codes to LPT1.
May not help but it could just work?
so its the whole USB thing thats throwing everything off. But almost all printers are usb these days. LTP1 sounds like a port though not a driver. I was looking up drivers. does this help any?
See Also: write to driver Command, close file Command, COMn: Keyword
Introduced: 2.0
Platforms: Desktop, Server and Web
Supported Operating Systems:
Summary:
Used with the open file, read from file, write to file, and close file commands to specify the line printer (parallel) port on Windows systems.
Examples:
write myData to file "LPT1:"
Use the LPT1: keyword to communicate through the parallel port.
Comments:
To read data from the parallel port, use the read from file command, specifying the keyword LPT1: as the file to read from.
To write data to the parallel port, use the write to file command.
So you may be able to write the data to LPT1: such that the POS will understand it, if the data reaches it.
You can use "net use LPT1: \\myhostname\mysharedprintername to redirect the LPT1 port to the USB printer (which you will need to have shared). It might just work. Or not, but you could try it.
on mouseUp
open file "LPT1: \\"& $COMPUTERNAME &"\Staff" for binary write
put numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250) into myData
write myData to file "LPT1: \\"& $COMPUTERNAME &"\Staff"
close file "LPT1: \\"& $COMPUTERNAME &"\Staff"
end mouseUp
No, don't put the share details as part of the livecode.
First share the POS printer in the windows printer settings.
Next, from a windows command prompt type the net use command,as in:
net use LPT1: \\myPC\thePOS
(Substitute your pc name and printer share name of course)
Then from lc just write the data to file LPT1 as per the dictionary. The net use command will have windows intercept the data and redirect it. Whether successfully or not is another question.
on mouseUp
open file "LPT1:" for binary write
put numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250) into myData
write myData to file "LPT1:"
close file "LPT1:"
end mouseUp