Link to home
Start Free TrialLog in
Avatar of roosiedb
roosiedb

asked on

Open cash drawer without printing text

Hi there,

I am using a Star TSP 200-24 printer, Delphi 5.0 and Windows 98...

Now, I want to open the cash drawer which has been attached to the Star printer. The printer itself is connected to the LPT1 port.

If I am using the below-mentioned code, the cash drawer will open, but there will be printed some text too:

      AssignPrn(BonFile);
      Rewrite(BonFile);
      WriteLn(BonFile,Chr(7));
      CloseFile(BonFile);

In other words, this is not working the way I want.

For your information, the following example was provided by the Developers FAQ Document, shipped with the printer:

      Open printer.port for output as 1
      Print #1, Chr(7)
      Close 1

This example is for VB, so it doesn't work in Delphi.

Please help me!!

Thank you in advance.

RoosieDB
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kretzschmar
just a guess

AssignPrn(BonFile);
Rewrite(BonFile);
Write(BonFile,Chr(7));  //No WriteLn
CloseFile(BonFile);

Avatar of roosiedb
roosiedb

ASKER

Hi Bruintje (a Dutch name ??),

I will try your solution soon.
The Chr(7) is the bell character. So I am not sure if this is printing text... There was also some remark about the font. If I want to use special characters, I need the "Control" font before I send anything to the printer. I've already tried that, but if you have some more tips then please let me know.

Hi kretzschmar,

I've already tried the write-command (not writeln), this was not working. Sorry. Any more tips? Please let me know.

Thank you both in advance !!

RoosieDB
Hi RoosieDB,

you could check this long url

http://groups.google.com/groups?hl=nl&lr=&threadm=3be84868_2%40dnews&rnum=1&prev=/groups%3Fq%3Ddelphi%2Bprint%2Bcash%2Bdrawer%26hl%3Dnl%26lr%3D%26selm%3D3be84868_2%2540dnews%26rnum%3D1

guess there could be something in it that you could use

btw Bruintje is from Bruintje Beer, Dutch version of Rupert Bear

HAGD
:O)Bruintje
Hi Bruintje,

I will check the URL as soon as I get home.

Best regards,
RoosieDB
(= Dutch for "Van Roosmalen" from [city] Den Bosch)

P.S. Kretzschmar, I hope you will also provide me with some more info. This issue is very important for me to solve. Thank you in advance!!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dear magellanLS,

Just a quick question, to make sure I have attached the printer on the right port...

What hex-code do I need when I seem to have connect this printer on COM1, COM2, COM3 or COM4 ???

It's not working yet, so I am trying different things right now.

Thank you.
roosiedb
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between bruintje, magellanLS and ITugay

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer