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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a escape sequence in VB6

Status
Not open for further replies.

jlstowe

MIS
May 14, 2003
4
US
I have to create a program which prints to a card printer.
The output needs to be in this format:
(esc)T(space)part1(space)part2(space)part3(space)ect..(space)data(carrage return)
Where T and part# are internally recognized parameteres to the printer.

I can get the output to print out exactly how it looks.

The problem is that it isn't converting the parameters into
the objects they represent.
 
Perhaps you can show us the actual print commands with the escape sequences?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I got the "^233" escape code out of the old program for printing cards. The old program was written for a primos system.


e = "^233"
REM **this line clears the printer's print buffer**
firstline = e + "F" + Chr(13)
REM **this line prints the barcode based on the number in record.cardnum**
secondline = e + "B" + " 100 475 0 5 2 6 150 0" + record.cardnum + Chr(13)
REM **this line prints the record.cardnum in plain text**
thirdline = e + "T" + " 200 550 0 0 0 60 1 " + record.cardnum + Chr(13)
REM **this line prints the record.name in plain text**
fourthline = e + "T" + " 100 610 0 0 0 60 1 " + record.name + Chr(13)
REM **this line prints the date in plain text**
fifthline = e + "T" + " 750 480 0 0 0 50 1 " + Str(Date) + Chr(13)
REM **this is a blank place holder line**
sixthline = e + "T" + " 750 520 0 0 0 50 1 " + Chr(13)
REM **this line allows for a monochrome graphic and then ejects the card**
seventhline = e + "I"

completeline = firstline + secondline + thirdline + fourthline + fifthline + sixthline + seventhline
Printer.Print Chr(completeline)
Printer.EndDoc
 
I think what may be happening is that e is being taken as a 4 character string, and not an escape character. I'm not really sure how the primos system interprets that string.

First thing I would try is to chr(27) as the escape character.

e = chr(27) ' Escape character





Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
When I put that in all I get is the [] symbol printing on the card instead of ^233.
 
I would replace all of the "+" signs with "&" for better string concatenation. Also, I don't think you should use the Chr function in the print line.
[code[
sixthline = e & "T" & " 750 520 0 0 0 50 1 & + Chr(13)
seventhline = e & "I"

completeline = firstline & secondline & thirdline & fourthline & fifthline & sixthline & seventhline
Printer.Print completeline
[/code]
I would also consult with the documentation provided with the printer. It may be that the proper escape sequece is the escape character followed by the character chr(233). It is really hard to know with seeing the actual printer documentation.

Might try
e = chr(27) & chr(233)







Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
The escape code is "~C2".
Thank you for all of your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top