Announcement

Collapse
No announcement yet.

cuecat TSR help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • cuecat TSR help

    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
    Jonathan Simpson

  • #2
    Ok, while I am thinking about it... what kind of updates are in PB 3.5 versus 3.2.
    Right now, I still have pb 3.2, back from 96 I think, when my brother bought it for me. My biggest dillema, is trying to use the manual after it got all wet. I can still use it, I just have to unstick the pages to find what I want
    So, the question here is: should I go for 3.5?


    ------------------
    Jonathan Simpson
    Jonathan Simpson

    Comment


    • #3
      error 5 at pgm-ctr: 545
      First thing you do is Compile/Find Error. That will translate "pgm-ctr:545" into the specific line of source code on which the error occurred.

      That should be a big hint as to what is wrong.

      Without running your code, best guess is one of your string operations is trying to take a MID$ or LEFT$ with either a position or length argument less than one.

      MCM

      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        What's New in PowerBASIC 3.5 since version 3.2?

        http://www.powerbasic.com/products/pbdos/32to35.asp

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment

        Working...
        X