Skip to content

Instantly share code, notes, and snippets.

@filipekiss
Last active September 1, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filipekiss/330cd87b4f4f84a6cd6e to your computer and use it in GitHub Desktop.
Save filipekiss/330cd87b4f4f84a6cd6e to your computer and use it in GitHub Desktop.
Takes a photo and screenshot. Just put this on your crontab.
#!/usr/bin/env bash
# Based on https://gist.github.com/DNA/7616b825261f97223953
# Improvements:
# - Capture up to 2 screens
# - Variable configuration for the binaries path
TODAY_SCREENCAPTURE_FOLDER="$HOME/Dropbox/Autophoto/screen/$(date +%Y%m%d)";
TODAY_SNAPS_FOLDER="$HOME/Dropbox/Autophoto/snaps/$(date +%Y%m%d)";
SCREENCAPTURE_BIN="/usr/sbin/screencapture"
IMAGESNAP_BIN="/usr/local/bin/imagesnap"
if [ ! -d $TODAY_SCREENCAPTURE_FOLDER ]; then
mkdir -p $TODAY_SCREENCAPTURE_FOLDER
fi
if [ ! -d $TODAY_SNAPS_FOLDER ]; then
mkdir -p $TODAY_SNAPS_FOLDER
fi
SCREENCAPTURE_COMMAND=$SCREENCAPTURE_BIN" -x -t jpg $TODAY_SCREENCAPTURE_FOLDER/"$(date +%H%M)"-1.jpg $TODAY_SCREENCAPTURE_FOLDER/$(date +%H%M)-2.jpg"
IMAGESNAP_COMMAND=$IMAGESNAP_BIN" -w 1.5 -q $TODAY_SNAPS_FOLDER/"$(date +%H%M)"p.jpg"
eval $SCREENCAPTURE_COMMAND
eval $IMAGESNAP_COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment