Page 1 of 3

POS kick drawer

Posted: Mon Oct 13, 2014 3:19 am
by Da_Elf
I only found one post ages ago for this kind of question and it never really answered it
Ive got my printer installed and livecode prints out a nice dynamically filled invoice to the USB printer by setting the printer name then simply telling it to print card.
now then. I can set in the windows print software for that printer that if a cash drawer is attached i can tell it to open the drawer when the print is done (or at the start of the print) however i dont want the drawer to always open when printing. Or sometimes i was the drawer to open without printing. I tried one of the methods listed here
http://support.epostraders.co.uk/suppor ... erKick.pdf
in microsoft word i set the font to "control" and told it to print just an A in that font and it kicks the drawer without printing.
this doesnt really help me from livecode though and i cant even find the font "control" in livecode.
The 2nd method that looks promising is to send an ESC command to the USB printer.... but this one leaves me clueless. The other programming advice they give i assume is something like VB or C++ or something which is gibberish to me and also doesnt help in livecode.
Has anyone been down this path and has an answer for me? Ive been all over google and still cant find specifics

Re: POS kick drawer

Posted: Tue Oct 14, 2014 1:17 am
by [-hh]
Hi, are you on Mac or Linux? Then you could try with CUPS.

Re: POS kick drawer

Posted: Tue Oct 14, 2014 2:37 am
by Da_Elf
PC windows 8

Re: POS kick drawer

Posted: Tue Oct 14, 2014 7:49 am
by SparkOut
You could try making a field with the ASCII control chars from the PDF : chr(27) and so on. Then have a button which prints the contents of the field. I'd have a try here but apart from not having a pos drawer I am not handy to access computer atm and just have this phone.

Re: POS kick drawer

Posted: Tue Oct 14, 2014 10:32 pm
by Da_Elf
ah well the main question is how to tell it to print ascii characters. it cant be as simple as typing chr(27) in a field. it would just print chr(27)

Re: POS kick drawer

Posted: Wed Oct 15, 2014 7:33 am
by SparkOut
Ah, try numtochar

Re: POS kick drawer

Posted: Wed Oct 15, 2014 10:53 am
by Da_Elf
the same way i can type:: answer"hello" . is it possible to type:: print"hello".. or in my case print the ascii stuff?

Re: POS kick drawer

Posted: Wed Oct 15, 2014 9:56 pm
by Da_Elf
i feel like a moron. I tried loading on the generic text thing to try it out ( http://support.epostraders.co.uk/suppor ... erKick.pdf ) however it says i need to press and hold the Esc key. When i do this the window closes

Re: POS kick drawer

Posted: Thu Oct 16, 2014 1:14 am
by [-hh]
I can' test it here, but you could try

Code: Select all

revPrintText numToByte(27)
and for the ESC problem you could try to trap escapeKey

Code: Select all

on escapeKey
end escapeKey

Re: POS kick drawer

Posted: Thu Oct 16, 2014 2:03 pm
by Da_Elf
hmm. i typed the below. First thing that hapened was it popped open the print window which i dont want. At least when using the normal print this stack it will just print with no dialog box. secondly i dont think the escape is working. it prints a little slip with ←p0↓· or something close to that the down arrow looks more like a vertical bar with a small right bar sticking out of the middle of it and the last one is a u with accent on it. weird.

Code: Select all

   revPrintText numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250)
edit

solved the print window thing with revShowPrintDialog showPageSetup,showPrintDialog. However the fact that it prints what im getting and it doesnt print p0 50 500 when i type (alt25) ↓ i get the down arrow not 50

Re: POS kick drawer

Posted: Thu Oct 16, 2014 3:11 pm
by [-hh]
Hi,

I'm seldom on Win (mostly for testing only). But this is here now more hardware specific.
The arrows are a good sign because they indicate that you are sending non-printable chars that have some pseudographic display on screen or printer.

So I looked into your POS manual and found that they are using character code table PC437.

Options to go on.
I can think of the following. (May be you already know most. Then this is for other readers.)
  • Test if the driver awaits HexCode for the nonprintable control chars from the low code page region.
  • Convert your input with a codeTable function (from web or faster: make your own)
  • [ install an asciifont that displays table PC437 (see font links below) ]
  • install a PC437 keyboard layout; ready made from web or use
    http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx
Good info, also for non-specialists.
http://en.wikipedia.org/wiki/Code_page_437
http://en.wikipedia.org/wiki/Escape_sequence
http://en.wikipedia.org/wiki/Control_character

CP437 fonts (for Win, also good for displaying pseudo graphics, DOS-like).
http://www.microsoft.com/typography/fon ... x?FMID=708
http://eistee.gmxhome.de/ascii/indexen.htm

Unicode mapping for codepage 437.
ftp://ftp.unicode.org/Public/MAPPINGS/V ... /CP437.TXT

Looks to be "a lot", but they explain everything thoroughly. Presumably you have less problems with that than I do. In any case I would give it a try for at least several hours.

If you succes it would be fine to summarize in a note here how you managed/solved the code page issue within LC.

Hermann

Re: POS kick drawer

Posted: Thu Oct 16, 2014 3:22 pm
by AxWald
Hi,
Da_Elf wrote:

Code: Select all

   revPrintText numToByte(27)&numToByte(112)&numToByte(48)&numToByte(25)&numToByte(250)
Have you tried it with spaces? "revPrintText numToByte(27) && numToByte(112) && ..." ? And maybe with "numtochar" instead of "numtobyte"?

Another thing, dunno if you can address/ map the printer to a COM: port. In this case, you could talk directly to it, even in binary. See "open file" in the dictionary.

Hope I could give you new ideas for testing ;-)

Re: POS kick drawer

Posted: Thu Oct 16, 2014 6:38 pm
by Da_Elf
ok, after extensive searching and trying and prodding none of the darned ascii stuff worked for me. I knew i could use a special font which i found in word called "control" and simply print an "A". but i couldnt find that font anywhere in livecode. However in the printer utilities i did find a place that can map one font to the control font. So i selected courier new (id never use that font) and mapped it to control font. I made a tiny substack with a field in it with a letter A and font set to courier new. when i printed the stack i get the correct responce of the drawer popping open. unfortunately a small slip of paper is fed and cut so have to work on that one now. but whoohoo. i get the drawer open now

Re: POS kick drawer

Posted: Fri Oct 17, 2014 5:07 pm
by jacque
I think the problem is that the print command isn't what you want. Printing will probably always cause a paper feed. Instead try opening the printer port using the "open file" command as was suggested and then just write to it. Or use sockets. Using the com port should also avoid needing any particular font.

The syntax isn't listed in the dictionary under "open file" but you can find it if you look up "com".

Re: POS kick drawer

Posted: Sat Oct 18, 2014 2:21 pm
by [-hh]
Yet another approach. Did you already have a look at this?

Building a DIY touch screen POS system
Cheap. Especially if you use a Raspberry Pi as server.

It uses this open source project, that has a *lot* of options: Unicentaopos.
Source is java, but how to connect to hardware is presumably portable to LC.