I would like to send portions of my OSX screen over IRC with the least fiddling.
Many apps do this already: CloudApp, Droplr, DropBox, Jing, etc
Problem is none of them return a link to the actual image. They return a link to a page containing the image, mainly so they can get advertising. This is no good for IRC; most IRC clients are smart enough to display an image when they see the URL for an image, but they are not smart enough to pull out the image from such a framing page.
I would like to write something that does this.
Shift + Cmd + F3 lets me select a rectangle with the mouse, and deposits the image on my desktop. This can be changed to another folder: http://osxdaily.com/2011/01/26/change-the-screenshot-save-file-location-in-mac-os-x/
I would like to have this image automatically upload onto the Internet and place a URL link in my clipboard.
I figured out half of the problem: the following bash script will upload an image and put the link into the clipboard:
#! /bin/bash
# Imagebin Loader
# π 27.1.2014
#
# Upload image to imagebin.org, put url to image in clipboard, make noise
filename="$1"
# http://stackoverflow.com/questions/4651437/how-to-set-a-bash-variable-equal-to-the-output-from-a-command
url_out=$(
curl -s \
--form "nickname=$(hostname)" \
--form "image=@$filename;type=$(file --brief -L --mime-type "$filename")" \
--form "disclaimer_agree=Y" \
--form "mode=add" \
--form "Submit=Submit" \
http://imagebin.org/index.php \
-w '%{redirect_url}\n'\
)
# e.g. http://imagebin.org/288917
echo "$url_out"
# http://mywiki.wooledge.org/BashFAQ/073
number=${url_out##*/}
printf -v new_url "http://imagebin.org/index.php?mode=image&id=%s" $number
# e.g. http://imagebin.org/index.php?mode=image&id=288917
echo "$new_url"
#http://osxdaily.com/2007/03/05/manipulating-the-clipboard-from-the-command-line/
printf "$new_url" | pbcopy
say -v Trinoids "Fooo"
Now how can I accomplish the other part of the puzzle: whenever a new screenshot arrives on the desktop, to automatically execute this script with it?
LINK: https://apple.stackexchange.com/questions/118698/free-screen-grabber-for-os-x