1

Mac 用の Alfred アプリを購入したばかりで、オンラインで見つけた次のスクリプトを使用したいと考えています。

---------------------------------------------------
--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

evernoteを開いて何かを検索する必要があります。これは正常に動作しますが、たとえばボートという単語を検索する代わりに、二重引用符を使用して「ボート」を検索し、明らかに一致するものはありません。

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 に答える