1

我刚刚为我的 Mac 购买了 Alfred App,我想使用我在网上找到的这个脚本:

---------------------------------------------------
--Modified by: Pontus Sundén, http://psu.se
--Icon from: http://findicons.com/pack/1362/private_eye_act_1
---------------------------------------------------
on alfred_script(strQuery)
    --Get the parameters passed to the script - this is the search query
    set strSearchCriteria to SpaceList(strQuery)

    --Try to populated an existing window with the search query
    tell application "Evernote"
        try
            set query string of window 1 to strSearchCriteria
        on error
            --No existing window, open an new one
            open collection window with query string strSearchCriteria
        end try
    end tell
    tell application "System Events" to set frontmost of process "Evernote" to true
end alfred_script


--Take a list of text items and retrun them as a string with a space between each item
on SpaceList(astrItems)
    --Store what the current list delimiter is
    set tmpDelimiters to AppleScript's text item delimiters

    --Set the list delimiter to a space and build the string we want to pass back
    set AppleScript's text item delimiters to " "
    set strReturn to astrItems as string

    --Set the list delimiter back to what it was previously
    set AppleScript's text item delimiters to tmpDelimiters

    --Return the string we built
    return strReturn
end SpaceList

这应该打开印象笔记并搜索一些东西。它工作正常,但不是搜索单词boat,而是搜索带有双引号的“boat”,显然这不会产生匹配项。

4

2 回答 2

0

您可以使用 UI 脚本来填充搜索字段,如下所示:

set xxx to "boat"
activate application "Evernote"
tell application "System Events" to tell process "Evernote"
    set value of text field 1 of group 4 of tool bar 1 of window 1 to xxx
end tell
于 2012-06-03T17:43:37.957 回答
0

你的脚本是完全正确的——通过 AppleScript 传递的搜索词的虚假引用是客户端版本 3 中已知的 Evernote 错误(嗯,“已知”如“我前一段时间为它打开了支持票证,Evernote 承认了这一点”;我会添加一个链接到工单,但这些链接对打开它的用户来说是私有的......不过会更新进度)。

在他们解决它之前,您将不得不使用建议的 GUI 脚本解决方案作为解决方法,或者手动更正搜索字符串。

于 2012-06-03T20:01:36.010 回答