Last active
April 8, 2022 11:52
-
-
Save Romern/2a63b831b9b2b6a9723d1001e609fd1f to your computer and use it in GitHub Desktop.
Script to poll for the buttons on a scanner and run a script if pressed. Currently just checks if any button is pressed, but could be easily adjustable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
FOLDER="/home/roman/Scanned/" | |
PORT="$(lsusb | grep CanoScan | pcregrep -o1 "Bus ([0-9]*)")" | |
DEVICE="$(lsusb | grep CanoScan | pcregrep -o1 "Device ([0-9]*)")" | |
SCANBD_DEVICE="genesys:libusb:${PORT}:${DEVICE}" | |
scanimage --format jpeg -d ${SCANBD_DEVICE} --source Flatbed --resolution 300 -o /tmp/scan.jpg | |
tesseract /tmp/scan.jpg "${FOLDER}/scan_$(date +'%FT%T')" -l deu pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment