Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHR() string 1

Status
Not open for further replies.

tondi

Technical User
Nov 29, 2001
115
US
I have a client who has IBM receipt printer with cash drawer attached.

String to open drawer is ESC 112 0 100 100 (the two 100s are intervals and I'm not sure what they mean.)

My problem is the expression field in the software that sends the commands is not long enough to get all the codes in using CHR(27)+CHR(112)+CHR(0)+CHR(100)+CHR(100). I am two spaces short of getting it all in.

What would the expression look like if using HEX or CHAR strings? Are the 100 intervals necessary or can they be reduced to 99 or other smaller number?

Thanks and Happy Holidays to All

Tony
 
Cn you use the old Alt key technique to enter the characters into a text string?

Code:
"?p"+chr(0)+"dd"

Regards

Griff
Keep [Smile]ing
 

Tony,

I'm not sure I understand what you mean by "two spaces short of getting it all in". Where is the restriction on the length of the string?

In any case, I would have thought you could do it like this:

SET PRINTER TO NAME <receipt printer driver's name>
??? CHR(27)+CHR(112)+CHR(0)+CHR(100)+CHR(100)
SET PRINTER TO

If there is no printer driver available, SET PRINTER TO <the port to which the printer is attached>.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks for the replies ...

Dave, yes we have a table field where we enter the string to be sent to drawer through the printer. I am a couple of spaces short of entering the string as Mike suggested.

Mike, thanks thats exactly how we do it. I just need to shorten the string.

Griff, that could work if the field would accept lower case characters. The program makes all entries UPPER by default.

Are the CHR(100) intervals necessary and if so must they be set at 100? CHR(99) would fit.

Tony
 

Can you just widen the field in your table instead of shortening the string?
 
Are the CHR(100) intervals necessary and if so must they be set at 100? CHR(99) would fit.
I'm guessing none of us who replied have the same test environment as you. You'll just have to try 99 and see what happens.
You could try as you mentioned, putting them in as hex values.
Use transform to find them:
Code:
?Transform(Asc(Chr(27)) , '@0x')  &&...0x0000001B
?Transform(Asc(Chr(112)) , '@0x')  &&... 0x00000070
for instance.
Obbtain the hex values, then put them in there shortened as 0x1B + 0x70 etc.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Thanks Dave,
I want to avoid changing field length because that would involve a data conversion for all clients if I modify the structure. I will try the CHR(99) first, then the hex values.
Happy Holidays,
Tony
 
Tony,

If you have access to the source, you could change the formatting of the field - letting the lowercase chars in - without modifying the data schema for all your clients!

Just take the ! off the formatting.

Martin


Regards

Griff
Keep [Smile]ing
 
Thanks Griff but no access to source at customer site 100 miles away.

Thanks again Dave..you have a star
 
Do you know where the string is stored - if you know the table and field, you can drop the string into it using a patch...

Something like

Code:
set exclusive off
use MyTable
replace MyPrinterString with chr(27)+"p"+chr(0)+"dd"
quit


Regards

Griff
Keep [Smile]ing
 
Thanks Griff,
I can access the back door of the application and do that by phone if necessary.
Your response also deserves a star.
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top