作者peacedove (林帛亨加油!!!)
看板MAC
标题[软体] 右键缩址
时间Mon Apr 18 23:45:04 2011
今天研究了一个晚上XD
因为我一直不想读automator跟applescript的文件Orz
所以最後没有达到我想要的功能
但也不差了
我本来预想的功能:
复制网址後,再想贴上短网址的地方右键"贴上短网址"
目前的功能:
选取网址後,右键选择"缩址",到想贴上短网址的地方贴上
下面是教学,不用装甚麽其他的软体
另外因为我是使用英文的作业系统,所以下面的一些名称都会用英文的
非常抱歉
1.到你的applications 里面打开 automator
2.选择 service
3.Service receives selected "URLs" in "any application"
(URLs 跟 any application於下拉式选单中选取)
4.左上方搜寻框搜寻 applescript
5.将Run Applescript 拖至右方区块
6.将Run Applescript 中文字方块内容全部删除 并贴上以下程式码
(此段程式码修改自
http://tinyurl.com/5c43v9)
on run {input, parameters}
set the ClipURL to (input as string)
ignoring case
if ((characters 1 through 4 of ClipURL as string) is not "http") then
set ClipURL to ("
http://" & ClipURL)
end if
set curlCMD to
"curl --stderr /dev/null \"
http://tinyurl.com/api-create.php?url="
& ClipURL & "\""
-- Run the script and get the result:
set tinyURL to (do shell script curlCMD)
set the clipboard to tinyURL
return tinyURL
end ignoring
end run
其中
set curlCMD to
"curl --stderr /dev/null \"
http://tinyurl.com/api-create.php?url="
& ClipURL & "\""
为同一行
7.存档,并取一个你喜欢的名字(这个名字将出现再右键选单中)
8.完成
谢谢指教
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.32.15.242
※ 编辑: peacedove 来自: 114.32.15.242 (04/18 23:49)
1F:推 mmmmmfff:推 04/18 23:49
2F:→ peacedove:突然想到这样好像就必须要用cocoa的软体才能用 04/18 23:57
3F:→ peacedove:如果要放诸四海皆准好像还是要配合quicksilver才行Q_Q 04/18 23:57
4F:→ peacedove:我参考的文章是要用textexpander 可是那个好像要钱Q_Q 04/19 00:01
5F:推 theory:因为 service (服务) 本身就是 Cocoa only 的功能 .. 04/19 01:54
6F:推 greatroy:不好意思,请问存档後的档案预设会在哪? (新手菜鸟) 04/19 16:16
7F:推 andy12199:太方便了给推 04/19 16:48
8F:→ peacedove:家目录下的 /library/services 04/19 17:17
9F:推 greatroy:感谢~~ 用了一天,超好用的^^ 04/20 09:41