Last active
September 26, 2015 06:07
-
-
Save jasonbouffard/1051544 to your computer and use it in GitHub Desktop.
OSX Bash script to snap an interactive screenshot into your Dropbox public folder and copy the public url to your clipboard.
This file contains 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 | |
DATE=$(date +"%Y-%m-%d"); | |
TIME=$(date +"%I.%M.%S"); | |
AMPM=$(date +"%p"); | |
FILENAME=Screen\ shot\ $DATE\ at\ $TIME\ $AMPM.png; | |
# You can export you DROPBOX_USER_ID in your .profile | |
# or hardcode it here by replacing YOURDROPBOXUSERID | |
DB_USER_ID=${DROPBOX_USER_ID-YOURDROPBOXUSERID}; | |
# Make sure you create the Screenshots directory in | |
# your public directory | |
DB_BASE_DIR=~/Dropbox/Public/Screenshots; | |
DB_BASE_URL=https://dl.dropboxusercontent.com/u; | |
screencapture -i "$DB_BASE_DIR/$FILENAME"; | |
# user may have escaped out of the screencapture | |
if [ -f "$DB_BASE_DIR/$FILENAME" ]; | |
then | |
URL_FILENAME=$(python -c "import urllib; print urllib.quote('''$FILENAME''')"); | |
URL_LONG="$DB_BASE_URL/$DB_USER_ID/Screenshots/$URL_FILENAME"; | |
# copy long url, if you paste before the shortener returns | |
echo $URL_LONG | pbcopy; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pretty easy to add a global keyboard shortcut.