Alfred 的 workflow 询问

2015-09-07 09:41:15 +08:00
 hywang1230

有没有一个 workflow 可以实现以下需求:输入关键字调用浏览器(chrome )的历史访问记录和书签

另外再问下:输入关键字显示 google 的搜索提示, baidu 的有了, google 的没找到

哪位知道的烦请告之下,谢谢啦!😊

3416 次点击
所在节点    问与答
5 条回复
Bown
2015-09-07 10:07:02 +08:00
自己建一条 workflow 就行了, Templates 选 open custom URL in specified browser ,然后 URL 填 chrome://history/或 chrome://bookmarks/, Browser 选 Chrome ,自己设一个触发的 keyword
freedomSky
2015-09-07 11:19:03 +08:00
实现过搜索 Chrome 书签的,要用到 AppleScript ,不知道现在能用 JavaScript 不能
就是调用 Chrome 的接口遍历一下书签文件夹,最终将符合条件的内容按 Alfred 的要求输出一下
下边是一部分 AppleScript ,参考一下吧:)

global rstXML

on run argv
set hdl to load script POSIX file (POSIX path of ((path to me as text ) & "::") & "handler.scpt")
global allBookmarks
set queryStr to argv as string
set allBookmarks to {}
set rstXML to "<?xml version=\"1.0\"?><items>"

tell application "Google Chrome"
set folders to (every bookmark folder of application "Google Chrome")

repeat with folder in folders
set f to folder
hdl's dealFolder (f, allBookmarks, queryStr )
end repeat
set rstXML to rstXML & "</items>"
return rstXML
end tell
end run

on dealItem (itm, allBookmarks, queryStr )
tell application "Google Chrome"
set t to (title of itm ) as string
set t to my q_encode (t )
set u to (URL of itm ) as string
set u to my q_encode (u )
set end of allBookmarks to {ptitle:t, purl:u}
# if t contains queryStr then
set rstXML to rstXML & "<item uid=\"" & u & "\" arg=\"" & u & "\" valid=\"YES\" type=\"file\">
<title>" & t & "</title>
<subtitle>" & u & "</subtitle>
<icon>flickr.png</icon>
</item>"
# end if
end tell
end dealItem

on dealFolder (curFld, allBookmarks, queryStr )
tell application "Google Chrome"
tell curFld
set itms to (every bookmark item )
repeat with itm in itms
my dealItem (itm, allBookmarks, queryStr )
end repeat

set flds to (every bookmark folder )
repeat with fld in flds
my dealFolder (fld, allBookmarks, queryStr )
end repeat
end tell
end tell
end dealFolder
ynyounuo
2015-09-07 11:19:45 +08:00
dullwit
2015-09-07 11:37:12 +08:00
@ynyounuo alfred 需要设置代理?
je11yfish
2015-09-07 12:45:24 +08:00
之前弄过一个书签的,可以下载试一下
要添加历史记录,直接在上面改或者加,都行;)
http://showme.pw/2015/08/31/Workflow-of-alfred/

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/218766

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX