OSX:自动上传截图imageBin,并把网址中的剪贴板 [英] OSX: Automatically upload screenshot to imageBin and put URL in clipboard

查看:212
本文介绍了OSX:自动上传截图imageBin,并把网址中的剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在IRC送我的OSX的屏幕部分用最少的摆弄。

I would like to send portions of my OSX screen over IRC with the least fiddling.

许多应用已经这样做了:CloudApp,Droplr,投放箱,静等

Many apps do this already: CloudApp, Droplr, DropBox, Jing, etc

问题是其中没有返回链接到实际图像。他们返回一个链接到包含图像的页面,主要是让他们能得到的广告。这是IRC没有好;大多数IRC客户端有足够的,当他们看到一个图像的URL来显示图像聪明,但他们没有足够的智慧从这样一个框架页面拉出形象。

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让我用鼠标选择一个矩形,和存款我的桌面上的图像。这是可以改变到另一个文件夹:的http://osxdaily.com/2011/01/26/change-the-screenshot-save-file-location-in-mac-os-x/

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/

我想自动拥有该图片上传到互联网,并放置一个URL链接在我的剪贴板中。

I would like to have this image automatically upload onto the Internet and place a URL link in my clipboard.

我想通了问题的一半:以下bash脚本会上传图片,并把链接复制到剪贴板:

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?

链接:<一个href=\"http://apple.stackexchange.com/questions/118698/free-screen-grabber-for-os-x\">http://apple.stackexchange.com/questions/118698/free-screen-grabber-for-os-x

推荐答案

使用一个文件夹的Automator动作时,新项目将被添加到该文件夹​​启动脚本。您可能要重定向,否则截图比桌面其他地方添加到您的桌面上的所有项目将得到上传

Use an Automator Folder Action to launch the script when new items are added to the folder. You might want to redirect screenshots to somewhere other than the Desktop otherwise all items added to your desktop will get uploaded.

这篇关于OSX:自动上传截图imageBin,并把网址中的剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆