2012-06-03 42 views
1

我刚刚购买了阿尔弗雷德应用为我的Mac,我想使用这个脚本我在网上找到:AppleScript的插入串入其间的应用双引号

--------------------------------------------------- 
--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和寻找的东西。它可以正常工作,但不是搜索,而是说一个单词boat,它会用双引号搜索“boat”,显然这不会产生任何匹配。

回答

0

你的剧本是完全正确的 - 虚假报价通过的AppleScript通过搜索词在3版本是已知的Evernote错误一个客户(好吧,“已知”,比如“我刚刚为它打开了一张支持凭单,Evernote也承认了它”;我会添加一个链接到票证,但这些对于打开它的用户是私有的......将虽然进度更新)。

在解决问题之前,您必须使用the suggested GUI Scripting solution作为解决方法,或手动更正搜索字符串。

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