Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Friday December 12, 2003
06:49 PM

Barcode Reading

[ #16315 ]

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.

#!/usr/local/bin/perl -s
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';
        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 -p
UE2: 086441950

And then "086441950" is put onto the clipboard (BTW, that is a scan of the new TV Guide with Aragorn on the cover ... 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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.