Ok, basically I am trying to create a lightweight TSR for use with a piece of Cash Register software.
What I need it to Do
1. When ALT-F10 is detected, become active and monitor the keyboard.
2. When scan input is complete and buffered, decode it.
3. Put the decoded scan into the keyboard buffer (used popup stuff)
Ok... all of this is done, and it works from the dos prompt. But when I start the cuecat thing, and then try to scan something from another program, I get an error message and it doesn't work.
error 5 at pgm-ctr: 545
Any suggestions?
Code below
DIM mcue(14)as string, cue as string
DIM scan1 as string, scan2 as string, scan3 as string
PRINT "Loading cuecat device driver 1.0"
'these can be moved to the sub and loaded every time if you want
'load conversion strings, later used for instr
scan1 = "C3CNCxChD3DNDxDhE3EN"
scan2 = "njfbDzvrTP"
scan3 = "ZYXW321076"
'"C3r1Dhj3DNn6DhDZ"
'Below is the actual conversion chart
'this chart is not used by the program and can be deleted.
'Each set of four characters represents three numbers, in order, as follows
' 1 2 3
'0 C3 n Z
'1 CN j Y
'2 Cx f X
'3 Ch b W
'4 D3 D 3
'5 DN z 2
'6 Dx v 1
'7 Dh r 0
'8 E3 T 7
'9 EN P 6
10 POPUP KEY chr$(08,68)
20 a& = setmem (-500000)
DO
30 POPUP SLEEP
sound 800,1
'record scan to scan buffer
cue = "": b$ = "": code$ = ""
DO UNTIL b$ = chr$(13):b$ = inkey$: cue = cue + b$:loop
'next line extracts only relevant data from scan
cue = MID$(cue, 32, LEN(cue) - 32)
'the processing of the string to make it readable is below
FOR divy = 0 TO (LEN(cue$) / 4) - 1
divyr = divy / 4
mcue$(divyr) = MID$(cue$, (divy * 4) + 1, (divy * 4) + 4): mcue$(divyr) = LEFT$(mcue$(divyr), 4)
code$ = code$ + LTRIM$(STR$(INSTR(scan1$, MID$(mcue$(divyr), 1, 2)) / 2 - .5))
code$ = code$ + LTRIM$(STR$(INSTR(scan2$, MID$(mcue$(divyr), 3, 1)) - 1))
code$ = code$ + LTRIM$(STR$(INSTR(scan3$, MID$(mcue$(divyr), 4, 1)) - 1))
NEXT divy
'code$ is our finished product, and is a string containing the product number
40 POPUP STUFF code$+chr$(13),0,0
LOOP
------------------
Jonathan Simpson
What I need it to Do
1. When ALT-F10 is detected, become active and monitor the keyboard.
2. When scan input is complete and buffered, decode it.
3. Put the decoded scan into the keyboard buffer (used popup stuff)
Ok... all of this is done, and it works from the dos prompt. But when I start the cuecat thing, and then try to scan something from another program, I get an error message and it doesn't work.
error 5 at pgm-ctr: 545
Any suggestions?
Code below
DIM mcue(14)as string, cue as string
DIM scan1 as string, scan2 as string, scan3 as string
PRINT "Loading cuecat device driver 1.0"
'these can be moved to the sub and loaded every time if you want
'load conversion strings, later used for instr
scan1 = "C3CNCxChD3DNDxDhE3EN"
scan2 = "njfbDzvrTP"
scan3 = "ZYXW321076"
'"C3r1Dhj3DNn6DhDZ"
'Below is the actual conversion chart
'this chart is not used by the program and can be deleted.
'Each set of four characters represents three numbers, in order, as follows
' 1 2 3
'0 C3 n Z
'1 CN j Y
'2 Cx f X
'3 Ch b W
'4 D3 D 3
'5 DN z 2
'6 Dx v 1
'7 Dh r 0
'8 E3 T 7
'9 EN P 6
10 POPUP KEY chr$(08,68)
20 a& = setmem (-500000)
DO
30 POPUP SLEEP
sound 800,1
'record scan to scan buffer
cue = "": b$ = "": code$ = ""
DO UNTIL b$ = chr$(13):b$ = inkey$: cue = cue + b$:loop
'next line extracts only relevant data from scan
cue = MID$(cue, 32, LEN(cue) - 32)
'the processing of the string to make it readable is below
FOR divy = 0 TO (LEN(cue$) / 4) - 1
divyr = divy / 4
mcue$(divyr) = MID$(cue$, (divy * 4) + 1, (divy * 4) + 4): mcue$(divyr) = LEFT$(mcue$(divyr), 4)
code$ = code$ + LTRIM$(STR$(INSTR(scan1$, MID$(mcue$(divyr), 1, 2)) / 2 - .5))
code$ = code$ + LTRIM$(STR$(INSTR(scan2$, MID$(mcue$(divyr), 3, 1)) - 1))
code$ = code$ + LTRIM$(STR$(INSTR(scan3$, MID$(mcue$(divyr), 4, 1)) - 1))
NEXT divy
'code$ is our finished product, and is a string containing the product number
40 POPUP STUFF code$+chr$(13),0,0
LOOP
------------------
Jonathan Simpson
Comment