POS kick drawer

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Tue Oct 21, 2014 6:37 pm

Was able to get back to this and tried

Code: Select all

   write numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250) to driver "C:\Windows\System32\drivers\usbprint.sys"
but i didnt get a responce

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: POS kick drawer

Post by [-hh] » Tue Oct 21, 2014 10:12 pm

I'm working rather seldom with drivers. Just a try:
Did you open the driver for *binary* write? And what is after writing to it in the result?
shiftLock happens

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Wed Oct 22, 2014 1:17 am

ok. looks like ive got a lot more reading. Didnt know about opening the driver or the binary thing.

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Thu Oct 23, 2014 8:45 pm

ok, I tried this and didn't get any response. I have sent numerous tech support messages to EPSON and have not received a single reply to any of them

Code: Select all

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


[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: POS kick drawer

Post by [-hh] » Thu Oct 23, 2014 11:39 pm

What's in the result?

Code: Select all

on mouseUp
  open ...
  write ...
  put the result
end mouseUp
shiftLock happens

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Fri Oct 24, 2014 2:25 am

it says file not open for write

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: POS kick drawer

Post by [-hh] » Fri Oct 24, 2014 3:34 am

This becomes now platform specific (I'm closer to Mac and Linux).
All I can say is what I would try now on Win:

Code: Select all

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.
shiftLock happens

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Sat Oct 25, 2014 3:49 am

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
Capture.PNG

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: POS kick drawer

Post by SparkOut » Sat Oct 25, 2014 8:21 am

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

Code: Select all

net use LPT1: \\<yourPCname>\<POSsharename>
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?

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Sat Oct 25, 2014 12:27 pm

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?
port.JPG

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: POS kick drawer

Post by SparkOut » Sat Oct 25, 2014 4:47 pm

the LC dictionary wrote:LPT1:

Type: keyword

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.

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Sat Oct 25, 2014 5:23 pm

Tried this to no success

Code: Select all

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: POS kick drawer

Post by SparkOut » Sat Oct 25, 2014 7:01 pm

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.

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: POS kick drawer

Post by Da_Elf » Sat Oct 25, 2014 7:15 pm

ok i used that and it said something about assignment succesfull or something then changed the code for just LPT1: but it still didnt work. This suckz

Code: Select all

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: POS kick drawer

Post by SparkOut » Sat Oct 25, 2014 7:19 pm

Try without the binary option. Then I think this avenue becomes a dead end.

Post Reply