用于搜索Evernote笔记的Applescript

时间:2014-04-29 19:36:35

标签: applescript evernote

所以我有一个Hazel规则,上面写着“如果我看到这家公司发表声明,请做X”,在这种情况下,我希望X能够做到以下几点。

  1. 打开Evernote
  2. 检查我是否有与下载文件标题相同标题的注释。
  3. 如果不是,请从该文件创建备注。如果是的话,什么也不做。
  4. 所以我到目前为止写的是。

    global fileNamez
    tell application "Finder"
        set fileNamez to name of theFile
        tell application "Evernote"
            activate
            delay (3)
            set searchString to "\"" & fileNamez & "\""
            set matches to find notes searchString
            if (not (matches exists)) then
                display dialog "no matches"
                create note title fileNamez from file theFile
            end if
        end tell
    end tell
    

    问题是搜索,它不起作用,我不知道它有什么问题。有人有什么想法吗?

1 个答案:

答案 0 :(得分:2)

尝试:

tell application "Finder" to set fileNamez to name of theFile

if application "Evernote" is not running then
    launch application "Evernote"
    delay 3
end if

tell application "Evernote" to set matches to find notes fileNamez
if matches = {} then
    tell application "Evernote" to set resultNote to create note from file theFile title fileNamez
    tell application "SystemUIServer" to display dialog "no matches" buttons {"OK"}
end if