Screenshot Sharing Script for Mac OS


2014-01-23

I recently wanted to move away from commercial screenshot sharing tools (I was using Jing), so I decided to create a script that takes screenshots, allows you to annotate them, then uploads them to a free webhost. The free host I use is 000webhost.com and I use ftp to upload the image. Here's the script:

#! /bin/bash
d=`date +%Y%m%d%I%M%S`
host="http://tr99.host56.com/"
password="*******"

screencapture -i $d".png";

open $d".png" #edit?

read go;

echo "put "$d.png | ftp ftp://a8533349:$password@tr99.host56.com:21/public_html/ \
    && echo $host"$d.png" | pbcopy
mv $d.png ~/pics/

That will take an interactive screenshot, open it in Preview so that you can edit and save it, then continue and upload it to your ftp host when you press any key in the terminal. I have my terminal (iTerm2) set to hide with a keyboard combo (ctrl+space) so that I can tell it to get out of the way if I'm taking a screenshot of something else. I assigned the script to a bash alias, so all I have to to do is open a terminal and type my alias. It also copies the url to the screenshot to your clipboard using pbcopy so that you can just paste it when you want to share it.