[sane-devel] shell script for scanning

m. allan noah kitno455 at gmail.com
Mon Jul 9 23:02:48 UTC 2007


man scanimage. look for the batch options. you want something more like:

scanimage --device-name "$DEVICE" --format "$FORMAT" --source
"$SOURCE" --batch file%d.tif

note that this does not redirect stdout...

allan

On 7/9/07, patrick blanchard <dspcypher at gmail.com> wrote:
> Hi,
>
> I am trying to finish a script for medical office scanning and thought it
> would be a nice project to share.
>
> Really I could use the help. :-]
>
> >> How do I scan Duplex and save the images? <<
>
> Anyway, here is how an office might scan documents.
>
> Employee sits down w/ pile of papers.
> Separate papers into piles destined for different patient charts.
> Pick up one pile and load into ADF.
>
> start script
>
> ...ask preliminary filing questions and confirm a few times for accuracy
> ...menu for one or two sides
> ...menu for sizes commonly scanned
> ...scan documents
> ...glue images into multipage tif if needed
>  ...file documents
> ...log user and time for accountability
>
> end script
>
> so here is what I have so far...
>
> > #!/bin/bash
> >
> > # local script variables
> >
> > # fujitsu scanner options
> > # forked scanimage variables
> > DEVICE="fujitsu:/dev/sg0" export DEVICE
> > SOURCE="ADF Back" export SOURCE
> > FORMAT="tiff" export FORMAT
> > OUTFILE="foo.tif" export OUTFILE
> >
> > # clear the screen
> > clear
> >
> > # gather file information
> > echo " *** Hi, before you start, please check that you're shoes are on the
> right feet. If not, please stop here and ask for assistance!"
> > echo ""
> >
> > echo "*** Please enter your name or initials then press the enter key."
> > read NAME
> >
> > echo "*** Welcome back $NAME!"
> > echo ""
> >
> > echo "*** First, some questions regarding your documents..."
> > echo "*** Enter the patient's chart ID (no leading zeros!) then press the
> enter key"
> > read CHART
> >
> > #debugging rx
> > #echo "length of $CHART" is ${#CHART}
> >
> > for ((ADDZEROS = (6 - ${#CHART}); ADDZEROS >= 0; ADDZEROS = ADDZEROS -
> 1));
> > do
> > CHART="0$CHART"
> > done
> >
> > echo "*** You entered $CHART, is that the chart number you want? (y/n)"
> > read CONFIRM
> >
> > echo "*** Enter a name for the document (maximum of 8 keystrokes!) then
> press the enter key"
> > read DOCUMENT
> >
> > echo "*** You entered $DOCUMENT, is that the document name you want?
> (y/n)"
> > read CONFIRM
> >
> > echo ">>> One last look! <<<"
> > echo "You want to scan $DOCUMENT and file it into chart number $CHART? (OK
> or NO)"
> > read CONFIRM
> >
> > # navigate and prepare file directory
> > cd /home/prairie/Desktop/records
> >
> > #mkdir /home/prairie/Desktop/records/emr/$chart
> > #chmod +rw /home/prairie/Desktop/records/emr/$chart
> >
> > # entertain a little...
> >
> > echo "*** OK already! here goes! ***"
> > echo "*** You should hear the scanner start now...if not, check your
> shoes."
> >
> > #scan it!
> > scanimage --device-name "$DEVICE" --format "$FORMAT" --source "$SOURCE" >
> "$OUTFILE"
> >
> > # check for errors
> > echo "*** Would you like to save $DOCUMENT to $CHART? (y/n)"
> > read CONFIRMATION
> >
> > # wrap it up
> > echo "*** Your document has been scanned and filed successfully!"
> > echo "*** Remember $NAME, always check your shoes before scanning!"
> >
> >
>
> --
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe your_password"
>              to sane-devel-request at lists.alioth.debian.org
>


-- 
"The truth is an offense, but not a sin"



More information about the sane-devel mailing list