Skip to content

Commit

Permalink
add my personal irfanview script
Browse files Browse the repository at this point in the history
  • Loading branch information
bepvte committed Feb 15, 2024
1 parent a3e0733 commit 10a0456
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/wsl_irfanview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env zsh
set -uo pipe_fail
zmodload -F zsh/zutil b:zparseopts

usage() {
cat <<-EOF
ocr <query>
-c dont use default dir
-i do scan
EOF
exit 0
}
if [[ $# == 0 ]]; then
usage
fi
typeset -A args
zparseopts -A args -D c i w:
echo $args[*]
if [[ -z ${args[(I)-c]} ]]; then
cd ~/Pictures # change this to your pictures directory
fi
tempdir=$(mktemp ocr.XXXXX --tmpdir)
set -x
ocrlocate $( [[ -z ${args[(I)-i]} ]] && echo - '-n' ) $@ | cut -f3- | xargs -d'\n' -n1 wslpath -w >> $tempdir
'/mnt/c/Program Files/IrfanView/i_view64.exe' /thumbs /filelist="$(wslpath -w $tempdir)" /title="$1" &
disown

0 comments on commit 10a0456

Please sign in to comment.