X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scan_stuff;h=3b913aeb340fc943f7cca1b09555c09ac6b0ddcc;hb=1886c7247cb16ed68a78cd5550b152689a465999;hp=152199c21938e6679582926bc8b63350938ec24c;hpb=c5c68f153dbba3d7d9b85c129ab5fefa202b2335;p=bin.git diff --git a/scan_stuff b/scan_stuff index 152199c..3b913ae 100755 --- a/scan_stuff +++ b/scan_stuff @@ -56,9 +56,13 @@ my %options = (device => 'fujitsu', debug => 0, help => 0, man => 0, + mode => 'Gray' ); GetOptions(\%options, + 'duplex!', + 'simplex!', + 'mode=s', 'debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; @@ -67,13 +71,21 @@ pod2usage({verbose=>2}) if $options{man}; $DEBUG = $options{debug}; my @USAGE_ERRORS; -# if (1) { -# push @USAGE_ERRORS,"You must pass something"; -# } +my $use_duplex = 1; +if (exists $options{duplex} and exists $options{simplex} and + not ($options{duplex} xor $options{simplex})) { + push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given"; +} pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS; +if ((exists $options{duplex} and not $options{duplex}) or + (exists $options{simplex} and $options{simplex})) { + $use_duplex = 0; +} + + use File::Find; if (@ARGV) { @@ -92,8 +104,8 @@ find(sub { return if /^\./; $last_num++; exec('scanimage','-d',$options{device}, - '--source','ADF Duplex','--mode','Gray','--format','tiff', - '--batch','out_'.sprintf('%03d',$last_num).'_%03d.tif'); + '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff', + '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif'); __END__