右鍵縮址 - MAC

Table of Contents

今天研究了一個晚上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.完成

謝謝指教

--

All Comments

Bethany avatarBethany2011-04-21
Tom avatarTom2011-04-24
突然想到這樣好像就必須要用cocoa的軟體才能用
如果要放諸四海皆準好像還是要配合quicksilver才行Q_Q
Erin avatarErin2011-04-25
我參考的文章是要用textexpander 可是那個好像要錢Q_Q
Kama avatarKama2011-04-25
因為 service (服務) 本身就是 Cocoa only 的功能 ..
Lucy avatarLucy2011-04-29
不好意思,請問存檔後的檔案預設會在哪? (新手菜鳥)
Todd Johnson avatarTodd Johnson2011-04-30
太方便了給推
Michael avatarMichael2011-05-04
家目錄下的 /library/services
Cara avatarCara2011-05-05
感謝~~ 用了一天,超好用的^^