V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
hywang1230
V2EX  ›  问与答

Alfred 的 workflow 询问

  •  
  •   hywang1230 · 2015-09-07 09:41:15 +08:00 · 3486 次点击
    这是一个创建于 3366 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

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

    5 条回复    2015-09-07 12:45:24 +08:00
    Bown
        1
    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
        2
    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
    dullwit
        4
    dullwit  
       2015-09-07 11:37:12 +08:00
    @ynyounuo alfred 需要设置代理?
    je11yfish
        5
    je11yfish  
       2015-09-07 12:45:24 +08:00
    之前弄过一个书签的,可以下载试一下
    要添加历史记录,直接在上面改或者加,都行;)
    http://showme.pw/2015/08/31/Workflow-of-alfred/
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2811 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 09:34 · PVG 17:34 · LAX 01:34 · JFK 04:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.