Skip to content

Instantly share code, notes, and snippets.

@summic
Created February 23, 2010 09:52
Show Gist options
  • Save summic/312041 to your computer and use it in GitHub Desktop.
Save summic/312041 to your computer and use it in GitHub Desktop.
Dict Action for QuickSilver
-- Dict Action for QuickSilver
--
-- Created by Summer Wang
-- Copyright (c) 2010 Summic, inc. All rights reserved.
--
using terms from application "Quicksilver"
on process text keyword
if keyword = "" then
show notification "请选择单词"
end if
set ret to do shell script "curl -d q=" & keyword & " http://dict.cn/ws.php | grep def" as text
if (count of paragraph of ret) > 0 then
set text item delimiters to ">"
set content to ret
set content to item 2 of (text items of content)
set text item delimiters to "<"
set content to item 1 of (text items of content)
else
set content to ""
end if
if content is "" then
show large type "Not Found..."
do shell script (say "not found")
else
show large type content
--todo:播放远程音频
do shell script (say keyword)
end if
end process text
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment