[sane-devel] shell script for scanning

patrick blanchard dspcypher at gmail.com
Mon Jul 9 22:39:43 UTC 2007


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!"
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20070709/bd6ccea2/attachment.htm 


More information about the sane-devel mailing list