Exe to open a cash drawer.

Help !!!
           I bought a cash drawer for my bussiness, just to find out that the program i'm using won't open it unless a ticket is printed during the sale. Not a good option.

Would somebody provide me with a small exe file to open the cash drawer at will ?

So I don't have to print a ticket for every 10 cents sale.

Configuration :
Windows XP Home
Ticket printer TM-U200 connected to LPT1
Cash Drawer to TM-U200 through RJ-11 connector
Software configured to send %A to open the cash drawer after a ticket is printed out.

Saludos,
Rogelio.

rogelio_65Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
To open cashdrawer you need to send the following character sequence:

27,112,0,25,250
or
27,112,0,64,240

But first you have to determine which kind of connector are you using. RJ-11 connector is not a PC connector, I guess you are talking about the printer-side connect, please check on PC-side, could be a serial port, if so, you have to determine baudrate and other parameters before sending the control string.
ns_germanyCommented:
Hi rogelio_65,

because your ticket printer is steering your drawer you can do it very easy. Just send a small print job to TM-U200, containing '%A' only.

Create a batch file, let's say 'OpenDrawer.bat', on your desktop:
-------------- cut here (this line not included) -------------------------
echo %%A LPT1:
-------------- cut here (this line not included) -------------------------
(You need a double percent sign to prevent Windows from interpreting '%A' as a variable.)

Double click on the batch and your drawer should open without any ticket printing. Does it?
ns_germanyCommented:
Sorry, typo again. This is the correct content for your batch:

echo %%A > LPT1:
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

rogelio_65Author Commented:
Hi ns,
        Tried your comment and several other combinations, but all I´ve got was the printer to print some chars.
e.g.:
command                   chars printed out
ECHO %%A>LPT1:      %A
ECHO %A>LPT1:         A
ECHO %0>LPT1:         "C:\OPENDRAWER.BAT"
ETC.
krakilin2001Commented:
A longshot but you could download PortMon (http://www.sysinternals.com/Utilities/Portmon.html) and monitor the activity to the parallel port when your program opens the cash drawer.  Just a thought.

M
ns_germanyCommented:
Hi rogelio,

this was because you said '%A to open the cash drawer' and I assumed it was right...  ;-)
Manual for TM-U200 says:  "Esc p 0 7 y" is the right sequence to open your drawer. Now this is a bit tricky:

- open a DOS command window
- type "copy con: open.txt" and press ENTER (command prompt won't come back)
- press ALT key and hold it
- type "27" on your numeric keypad
- release ALT key
- type "p07y"       (small "p" and "y"!)
- type Ctrl-z and then RETURN

Now you have a file named "open.txt" on your disk (in the directory where your command prompt was located!).
Every time you copy this file to LPT1: the drawer should open. So you could make a batch like:

copy open.txt LPT1:

and provide an icon for it to doubleclick. Voilá!
Please store these files (open.txt and the batch) next to each other in some directory to avoid path confusion.
Better like this?  I hope so...  ;-)
Good luck!
Jaime OlivaresSoftware ArchitectCommented:
>Manual for TM-U200 says:  "Esc p 0 7 y" is OK
Appears to be my original suggestion is ok:
>To open cashdrawer you need to send the following character sequence:
­>27,112,0,25,250, or
>27,112,0,64,240

But consider 3rd charater must be ascii 0, I think, not zero digit (ASCII 48), I think.

ns_germanyCommented:
rogelio_65 asked for a simple solution to open it, e. g. an exutable. It won't help him to know just the character sequence while standing in the fog how to send it?
OK, now this VBS saves the needed printer sequence to open the drawer ("open.txt"). And jaime's objection (thanks!) that it's not a "0" as a digit but a zero as byte is mentioned, too:

Dim myFSO, myFileHandle
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set myFileHandle = myFSO.CreateTextFile("open.txt")
myFileHandle.Write(Chr(27) & "p" & Chr(0) & "7y")
myFileHandle.Close
Set myFSO = Nothing

Now copying this file to LPT1: should open your drawer finally, rogelio, doesn't it?
eldarglCommented:
which model of drwer is?
rogelio_65Author Commented:
hi ns,
        The open.txt file worked, but stoped working once the admin program printed a ticket. Then i had to disable/enable the LPT1 port in order to make it work again.

By using Portmon program ( thanks kraki :) ) i was able to monitor the lpt1 port when the admin program opens the cash drawer. This is the log :

1B 3D 01 1B 63 30 02 1B 63 31 02 1B 63 33 00 1B 32 1B 52 00 1B

I've tried with no success to store the string in a txt file.

Any ideas?

rogelio_65Author Commented:
hi eldargl,
               CD030BS.
ns_germanyCommented:
Hm, so the character sequence is right because it works initially. Seems like the admin program doesn't release LPT1: after usage. (Is it a DOS one?) It won't help to have your recorded sequence in open.txt.
Can you define some custom printout to be used within the admin program? That would be the smartest way to do it.
In some POS software there is a feature called 'No sale' that just does what you want.

Another idea: what do you mean 'disable/enable LPT1:' exactly? Maybe we can do it in our batch...
Did POS software complain after disabling/enabling LPT1:, opening drawer by batch and then printing receipts again?
Jaime OlivaresSoftware ArchitectCommented:
Please try to generate a binary file:
1B 70 00 19 FA

Or with:
1B 70 00 40 F0

Then use:
COPY /B OPENDRAWER.TXT LPT1:

But  try without launching your program first, just from command prompt
rogelio_65Author Commented:
Jaime,
         I have no idea how to create a binary file.
Jaime OlivaresSoftware ArchitectCommented:
use an hex editor
by example: http://www.codeproject.com/tips/frhed.asp
rogelio_65Author Commented:
Hi ns

>Hm, so the character sequence is right because it works initially.
Yep.
> Seems like the admin
>program doesn't release LPT1: after usage. (Is it a DOS one?)
No, is not a dos program, and yes it seems like the admin program is not releasing LPT1: port.
> It won't help to have
>your recorded sequence in open.txt.
>Can you define some custom printout to be used within the admin program? That >would be the smartest way to do it.
>In some POS software there is a feature called 'No sale' that just does what you want.
Not in this program.
>Another idea: what do you mean 'disable/enable LPT1:' exactly? Maybe we can do it in >our batch...
I wnt to My PC/Properties/Hardware/Devices Administrator/ and then disabled/enabled port LPT1:
>Did POS software complain after disabling/enabling LPT1:, opening drawer by batch >and then printing receipts again?
Nop.
krakilin2001Commented:
You can download devcon which is basically a command line version of the device manager.  It will allow you to disable and reenable the port.  Not the most elegant solution I suppose, but if it works . . .

http://support.microsoft.com/kb/311272/EN-US/

You need to call devcon.exe from the i386 folder which unzips.

The commands are as follows:

devcon disable *PNP0401
devcon enable *PNP0401

Hope this helps :)

M

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.