Applescript для поиска заметок Evernote

Поэтому у меня есть правило Хейзел, которое гласит: "Если я увижу заявление от этой компании, сделай Х", в этом случае я хочу, чтобы Х сделал следующее.

  1. Открыть Evernote
  2. Проверьте, есть ли у меня заметка с тем же заголовком, что и заголовок загруженного файла.
  3. Если нет, создайте заметку из этого файла. Если да, ничего не делай.

Так что я написал до сих пор.

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 ответ

Решение

Пытаться:

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
Другие вопросы по тегам