CUECAT(1)

NAME
cuecat - decode :Cue:Cat™ scan codes and feed them to a shell command

SYNOPSIS
cuecat [ +type ... ] [ command ... ]

DESCRIPTION
The cuecat script repeatedly reads scan codes from a :Cue:Cat™ scanner via standard input, decodes and processes the scanned value, then prompts with Scan! for another scan code. It exits when it reads an EOF on standard input.

The processing starts by filtering the codes by type, then formatting them into a command if is is provided, then executing the resulting command. If no command is provided, the scan code information is printed on standard output.

If there are no type filters as well as no command, then the raw information from the scanner is printed. If either a type or a command argument is provided, the scan arguments are converted to EAN13 form. If the conversion fails - because of a bad scan, for instance - an error is reported.

Filters - of the form +type - cause any scan codes not of the indicated type (or types, if there more than one is provided) to be ignored. Types that start with “UP” are converted to a UPC code instead of an EAN13 code in this case. Similarly, type that start with “IB” is converted to an ISBN (including providing the correct check digit for the ISBN).

If a command is provided, it should include a single “%s” which will be replaced by the code (scan, EAN13, ISBN, or UPC) resulting from the scan, and then passed to a shell. To get a single “%” in the command, use “%%”.

USAGE
The following command will create a log of all UPA and UPE codes scanned in the file /tmp/upc-codes :

    cuecat +UPA +UPE 'echo %s >> /tmp/upc-codes'

For books, you can launch the w3m browser on the amazon.com page for a book with amazon.com's ISBN lookup facility like so:

    cuecat +IB5 w3m http://www.amazon.com/exec/obidos/ASIN/%s

You can probably substitute your favorite browser, but the command line syntax may need to change. Likewise, the quoting will depend on the shell being used.

More complex is using the addall price comparison engine to check a number of online book stores. That can be done with:

    cuecat +IB5 w3m 'http://www.addall.com/New/submitNew.cgi?location=10000&state=OK&dispCurr=USD&type=ISBN&query=%s'