所以我有一个Hazel规则,上面写着“如果我看到这家公司发表声明,请做X”,在这种情况下,我希望X能够做到以下几点。
所以我到目前为止写的是。
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
问题是搜索,它不起作用,我不知道它有什么问题。有人有什么想法吗?
答案 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