Barcode Reading
A couple of years ago I got a free CueCat USB barcode reader. I did some stuff so I could use it on my Mac. Well, I wanted to use it on Mac OS X, so I grabbed the old script, installed Barcode::Cuecat, modified my little script to save to the Mac OS X clipboard, and away I go. ... no, YOU'RE a geek!). Also, since I am using ClipboardSharing, I keep the reader connected to my server at my desk, and after running this program, it automatically sends the clipboard to my main workstation. ClipboardSharing is way neat.
#!/usr/local/bin/perl -sUsage:
use warnings;
use strict;
our($c, $p);
use Barcode::Cuecat;
my $bc = new Barcode::Cuecat;
print "Type 'q' to quit.\n" if $c;
while (chomp(my $data = <STDIN>)) {
last if $data eq 'q';
$bc->scan($data);
printf "%s: %s\n", $bc->type, $bc->code;
if ($p) {
open my $clip, '|pbcopy' or die $!;
print $clip $bc->code;
close $clip;
}
last unless $c;
}
[pudge@bourque bin]$ cuecat -pAnd then "086441950" is put onto the clipboard (BTW, that is a scan of the new TV Guide with Aragorn on the cover
^[[28~.C3nZC3nZC3n2D3bWDhvZDxnY.fGzX.C3T1D3DYE NzZ.
UE2: 086441950
Leave a comment