Skip to main content

[archive] Configurable escape codes

  • January 26, 2010
  • 5 replies
  • 0 views

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write

5 replies

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
so once you have the 07 1B, you then move x'07 1B' to apertura-cajon ... is this what you are doing?

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
You can use the HEX2ASCII library routine to do this.


01  hex-string     pic x(4).
01  ascii-chars    pic x(2).

move "071B" to hex-string.  | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.

** now ascii-chars will contain the two bytes with hex values 07 and 1B

The routine requires a 4-digit input and provides 2-digit output, so for setting a single character you could do this:


01  hex-string.
    03  hex-char       pic x(2).
    03  filler         pic x(2) value "00".
01  ascii-chars.
    03  ascii-char     pic x.
    03  filler         pic x.

move "07" to hex-char.    | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.
move ascii-char to apertura-cajon1.


Of course, you should read the full documentation in Appendix I... :)

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
You can use the HEX2ASCII library routine to do this.


01  hex-string     pic x(4).
01  ascii-chars    pic x(2).

move "071B" to hex-string.  | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.

** now ascii-chars will contain the two bytes with hex values 07 and 1B

The routine requires a 4-digit input and provides 2-digit output, so for setting a single character you could do this:


01  hex-string.
    03  hex-char       pic x(2).
    03  filler         pic x(2) value "00".
01  ascii-chars.
    03  ascii-char     pic x.
    03  filler         pic x.

move "07" to hex-char.    | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.
move ascii-char to apertura-cajon1.


Of course, you should read the full documentation in Appendix I... :)

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
You can use the HEX2ASCII library routine to do this.


01  hex-string     pic x(4).
01  ascii-chars    pic x(2).

move "071B" to hex-string.  | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.

** now ascii-chars will contain the two bytes with hex values 07 and 1B

The routine requires a 4-digit input and provides 2-digit output, so for setting a single character you could do this:


01  hex-string.
    03  hex-char       pic x(2).
    03  filler         pic x(2) value "00".
01  ascii-chars.
    03  ascii-char     pic x.
    03  filler         pic x.

move "07" to hex-char.    | or accept from user's input, etc.
call "HEX2ASCII" using ascii-chars, hex-string.
move ascii-char to apertura-cajon1.


Of course, you should read the full documentation in Appendix I... :)

[Migrated content. Thread originally posted on 26 January 2010]

Hello,

I look in the forums for a way to convert a string to a hexadecimal literal. I found this thread www.acucorp.com/.../showthread.php

But I don't get it. I think we both are trying the same thing, that i can type in a entry field the hexadecimal values 07 1B, etc then take the values in a string and writing the print record to send the escape codes.

But i cant get things working.

Any help?

01 apertura-cajon1 pic x(01) value spaces.

write print-record from apertura-cajon1 with no control
end-write
OK - I remember this post now.

Look at the example on my post using the redefines clause.

Also, word of warning - if you're trying to send hex codes to a printer then it appears to be very much hit and miss and thats even if you do actually use the spooler-direct clause

Personally we ended up going towards a 3rd party dll for the cash drawer interface