Posts Tagged screenshot
Automatically upload screenshots
Posted by Erik Bauffman in default on July 13, 2011
I take a lot of screenshots and was looking for a way to to the following:
- take a screenshot
- copy that screenshot with a unique name to my webserver
- put the full url to the screenshot in my clipboard
See the method below.
take_screenshot()
{
# create a directory 'screenshot' on the desktop
mkdir ~/Desktop/screenshot;
# go to that directory
cd ~/Desktop/screenshot &&
# capture a selected part of the screen
screencapture -ix ~/Desktop/screenshot/$(date +%Y-%m-%d-%H-%M-%S).png &&
# copy this screenshot to my hosting through ssh with scp
scp ~/Desktop/screenshot/$(ls | xargs | awk '{print $1}') spoon@crsolutions.be:www.spoon-library.be/screenshots/$(ls | xargs | awk '{print $1}') &&
# add the url to my clipboard
echo "http://www.spoon-library.be/screenshots/$(ls | xargs | awk '{print $1}')" | pbcopy &&
# get rid of this directory
rm -rf ~/Desktop/screenshot;
}
Thanks to @davelens for his help. You can also follow his blog