Skip to content

Instantly share code, notes, and snippets.

@Vegasq
Last active February 17, 2016 02:38
Show Gist options
  • Save Vegasq/8934869 to your computer and use it in GitHub Desktop.
Save Vegasq/8934869 to your computer and use it in GitHub Desktop.
Make GoogleChrome remote key screenshot
#!/bin/bash
# GetChromeRemoteCode.sh
# Run with CRON like
# * * * * * ~/chrome_remote.sh
# Required:
# google-chrome + chrome remote desktop
# tesseract-ocr
# wmctrl
# xdotool
# imagemagick
#
# YandexDisk as example of sharing tool
cd /home/$(whoami)/
# Modify this path to yur shared folder
UDIR="/home/$(whoami)/Yandex.Disk/server/r"
export DISPLAY=:0
if [ -d $UDIR ];
then
killall chrome
sleep 3
wmctrl -k on
sleep 3
export DISPLAY=:0 && xdotool mousemove 100 100 click 1
export DISPLAY=:0 && /opt/google/chrome/google-chrome --app-id=gbchcmhmhahfdphkhkmpfmihenigjmpp --profile-directory=Default --start-maximized &
sleep 3
export DISPLAY=:0 && xdotool key F11
sleep 3
export DISPLAY=:0 && xdotool mousemove 1245 272 click 1
sleep 7
export DISPLAY=:0 && import -window root screenshot.jpg
sleep 1
tesseract screenshot.jpg output_text.txt
cp screenshot.jpg /home/$(whoami)/Yandex.Disk/server/
cp output_text.txt /home/$(whoami)/Yandex.Disk/server/
sleep 3
rm -r $UDIR
else
echo ""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment