Screen shot script

    imageGood day to all!
    At one point, I was bored:
    1. Click PrintScreen
    2. Search for a place where to save it
    3. Open the service imageshack \ radikal \ habr effect
    4. Search on disk, where did I save all the same exactly this screenshot
    5. Copy the resulting link, and do with it .....

    Now I do:
    1. I press Ctrl + /
    2. I copy the received link and do it .....

    Is it really better? And did that bother you too? Then we climb under the cut!

    And here we have nothing complicated, but at first a little history;)
    Having decided to make a user-friendly tool, I honestly downloaded the source of gnome-utils, which contains gnome-screenshot, but realizing that the completion of this “miracle” will be much more complicated and interesting slower than writing the next command liner, I climbed into man curl ... I must say that you should not abuse this script. We don’t want to load our service to the ears so that it will slow down, or something worse? Therefore, we simply take screenshots and do not abuse it.
    I wrote an implementation for three popular and well-known file hosting sites:
    radikal.ru
    ImageShack
    Habr-Effect

    To use this brainchild, we need the following utilities:
    scrot curl xsel
    In Debian \ Ubuntu-like systems, you can install them using the following
    command : sudo aptitude install scrot curl xsel
    Next, create the file
    sudo touch /usr/sbin/screen.sh
    Make it executable
    sudo chmod + x /usr/sbin/screen.sh
    Open your favorite editor, and paste the following code:
    #! / bin / bash
    scrot /tmp/screen.png
    curl -F "upload = yes" -F "filename=@/tmp/screen.png" http://www.radikal.ru/action.aspx | grep "input_link_1 \" "| cut -d" \ "" -f4 | tee -ai /var/log/screens.log | xsel -b -i;
    tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
    notify-send "Downloading the screenshot" "The screenshot was downloaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000;
    curl -F "upload = yes" -F "file=@/tmp/screen.png" -L http://habrastorage.org/storage/habraeffect/05/68/056805cc524b8f502bd06f517fb65059.pngupload.php | grep -e "original-link" | awk -F "\" "'{print $ 10}' | tee -ai /var/log/screens.log | xsel -b -i;
    tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
    notify-send "Downloading the screenshot" "The screenshot was downloaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000; 

    ImageShack, for some reason I don’t know, does not want to accept such png's, so we use jpg for it. Can you tell me?
    #! / bin / bash
    scrot /tmp/screen.jpg
    curl -F "upload = yes" -F "fileupload=@/tmp/screen.jpg" http://www.imageshack.us/upload_api.php | grep "image_html" | awk -F "=" "'{print $ 2}' | cut -d" & "-f1 | tee -ai /var/log/screens.log | xsel -b -i;
    tail -n 1 /var/log/screens.log | xargs -I _ google-chrome _;
    notify-send "Downloading the screenshot" "The screenshot was downloaded successfully" -i /usr/share/icons/gnome/scalable/emblems/emblem-default.svg -t 5000;
    

    Choose what you want for yourself, and leave only ONE line with curl.

    Next, we sculpt in hot keys, in my gnome, it can be different for you, opening the buttons on our script.
    habrastorage.org/storage/habraeffect/05/68/056805cc524b8f502bd06f517fb65059.pngfiles/1a8/ef227f182/screen.png
    Here is an example for a gnome.
    Now that’s all)
    PS I suggest you create something similar for other photo hosting sites. Be sure to include in the article;)

    UPD0. Added ability to copy links to clipboard using xsel

    Also popular now: