B4J Question Open money box

soyVB6

Active Member
Licensed User
1. with this code I can print

B4X:
printString = Chr(10)& Chr(10)& Chr(10)
printString = printString & feed
printString = printString & Chr(10)& Chr(10)& Chr(10)& Chr(10)& Chr(10)

jo.RunMethod("printString",Array(printerGen,printString))
Dim by() As Byte = jo.RunMethodjo("cut",Null)
jo.RunMethod("printBytes",Array(printerGen,by))
2. How can I open the cash drawer?

Thanks colleagues
 

jerry07

Member
Licensed User
Is this Cash Drawer connected to printer?
Try to look in your printer manual for correct escape sequence.

You can also try following:
  • Chr(27)& Chr(112)& Chr(0)& Chr(100)& Chr(250)
  • Chr(27)& Chr(112)& Chr(48)& Chr(55)& Chr(121)
 

soyVB6

Active Member
Licensed User
Solution for the box that was connected to a USB printer


B4X:
public Sub OpenCaja
Try

'this line was the key
printString = printString & Chr(27)& Chr(112)& Chr(0)& Chr(50)& Chr(250)

jo.RunMethod("printString",Array(printerGen,printString))
Dim by() As Byte = jo.RunMethodjo("cut",Null)
jo.RunMethod("printBytes",Array(printerGen,by))
Catch

CallSubDelayed(Main,"ErrorPrint")
Log(LastException)
End Try

End Sub
 

emexes

Well-Known Member
Licensed User
I somehow missed your original query, through not realising that "money box" was "cash drawer", otherwise I would have immediately posted this guy's most excellent page aka global internet source for information about opening cash drawers.

http://www.dhpos.com/popopen2.htm

A comment of his that might resonate with you:

Serial devices are the bane of human existence and will undoubtedly be responsible for the extinction of all life on earth. Accessing the serial port is an iffy proposition at best and in many cases will not work at all.

Top Bloke :)

His list of control codes for opening cash register drawers is on the pages:

http://www.dhpos.com/popopen.htm
http://www.dhpos.com/popopen4.htm

I apologise re: being too late to be of use to you, but figured I'd post the link anyway because the next B4A programmer faced with a cash register printer/drawer is no doubt going to find this thread.
 
Last edited:
Top