Page 1 of 1

Equivalences ASCII <-> Rawkey for barcodes scanner

Posted: Tue Sep 02, 2008 9:11 pm
by bangkok
I would like to try to understand the weird logic of Rawkey.

Why not using regular ASCII values ?

My point : Rawkey uses (apparently) a code of 5 digits for special keys and 2 or 3 digits for regular characters.

For instance 65293 for CR (carriage return).

Where I can find an equivalence table ASCII <-> Rawkey system ?

I'm using a barcode scanner with special prefix and sufix. This system uses regular ASCII (extended). For instance, I set ASCII(160) as my prefix.

So to summarize :
-I'm able to catch the rawkey codes. But my problem is after : how decode them in regular ASCII ?

Posted: Wed Sep 03, 2008 10:10 am
by BvG
The problem is that ASCII is equal on all platforms only for very few control chars (like return, space and the most basic sentence signs) english chars and zero to nine. After that, it's open to guessing what a certain number actually will result in for the user. Therefore it's best to create your list yourself. The easiest way would be to make a list of the chars you'll actually use, and the ACSCII representing them on the barcode scanner. Then you could do something like this (untested):

Code: Select all

--assuming a list of <char>,<asciinumber>
on mosueUp
  repeat for each line theLine in field "asciiList"
    put chartonum(item 1 of theLine) into conversionArray[item 2 of theLine]
  end repeat
  put conversionArray[65]--should be the same, 65
  put numtochar(conversionArray[65]) --rev equivalent of ascii 65 = A
end mouseUp
Of course the example given is a bit boring, but for more interesting characters, the numbers will be different.

Posted: Thu Sep 04, 2008 6:28 pm
by bangkok
Thanks. This is actually what I did.

First I thought that I was missing a special function or command.
:D

Maybe in future versions of Revolution ?

Posted: Thu Sep 04, 2008 10:39 pm
by BvG
As I explained no, that can't be done.