Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Program to recognize text on the screen.
- function wait_for_window() {
- # first parameter - window title or part of the window title
- window_title="$1"
- time_sec=900
- while [[ 0 -ne $time_sec ]]; do
- echo "$time_sec, waiting... to appear"
- sleep 1
- time_sec=$[$time_sec-1]
- xdotool search --onlyvisible --name "$window_title" windowactivate
- if [[ $? == 0 ]]; then
- echo "window found"
- break
- fi
- done
- }
- function start_program() {
- window_title="dpScreenOCR"
- ps cax | grep "dpscreenocr"
- if [[ $? == 0 ]]; then
- echo "skipping" > /dev/null
- else
- nohup dpscreenocr &>/dev/null &
- wait_for_window "$window_title"
- xdotool getactivewindow windowminimize
- fi
- sleep 1
- xte 'keydown Control_L' 'keydown Alt_L' 'key grave' 'keyup Alt_L' 'keyup Control_L'
- sleep 3
- xte 'keydown Control_L' 'keydown Alt_L' 'key grave' 'keyup Alt_L' 'keyup Control_L'
- }
- start_program
- # depndencies:
- # sudo apt install xautomation xdotool
- # sudo add-apt-repository ppa:daniel.p/dpscreenocr
- # sudo apt update
- # sudo apt install dpscreenocr
- # ctrl+alt+grave - default screen capture keystroke
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement