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

POS kick drawer

Post by Da_Elf » Mon Oct 13, 2014 3:19 am

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

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

Re: POS kick drawer

Post by [-hh] » Tue Oct 14, 2014 1:17 am

Hi, are you on Mac or Linux? Then you could try with CUPS.
shiftLock happens

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

Re: POS kick drawer

Post by Da_Elf » Tue Oct 14, 2014 2:37 am

PC windows 8

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

Re: POS kick drawer

Post by SparkOut » Tue Oct 14, 2014 7:49 am

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.

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

Re: POS kick drawer

Post by Da_Elf » Tue Oct 14, 2014 10:32 pm

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)

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

Re: POS kick drawer

Post by SparkOut » Wed Oct 15, 2014 7:33 am

Ah, try numtochar

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

Re: POS kick drawer

Post by Da_Elf » Wed Oct 15, 2014 10:53 am

the same way i can type:: answer"hello" . is it possible to type:: print"hello".. or in my case print the ascii stuff?

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

Re: POS kick drawer

Post by Da_Elf » Wed Oct 15, 2014 9:56 pm

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

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

Re: POS kick drawer

Post by [-hh] » Thu Oct 16, 2014 1:14 am

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

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

Re: POS kick drawer

Post by Da_Elf » Thu Oct 16, 2014 2:03 pm

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

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

Re: POS kick drawer

Post by [-hh] » Thu Oct 16, 2014 3:11 pm

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

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: POS kick drawer

Post by AxWald » Thu Oct 16, 2014 3:22 pm

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 ;-)
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

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

Re: POS kick drawer

Post by Da_Elf » Thu Oct 16, 2014 6:38 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: POS kick drawer

Post by jacque » Fri Oct 17, 2014 5:07 pm

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".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: POS kick drawer

Post by [-hh] » Sat Oct 18, 2014 2:21 pm

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

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”