Skip to content

Instantly share code, notes, and snippets.

@panweizeng
Last active January 10, 2017 04:29
Show Gist options
  • Save panweizeng/2472157 to your computer and use it in GitHub Desktop.
Save panweizeng/2472157 to your computer and use it in GitHub Desktop.
evernote:在日志notebook下自动创建当天日期的note
--在Automator新建Service,Utilities选Run AppleScript,粘帖以下代码,保存命名为evernote-diarynew
--在System Prefrences > Keyboard > Application Shortcut,点+号新增
--Application选Evernote, Menu Title写evernote-diarynew, Keyboard Shortcut自选,推荐Command+D
on run {input, parameters}
set yearStr to do shell script "date +%Y"
set dateStr to do shell script "date +%Y-%m-%d"
set diaryNotebook to "[日志-" & yearStr & "]"
set searchQuery to ("notebook:" & diaryNotebook & " intitle:" & dateStr) as string
set searchQueryCollection to ("notebook:" & diaryNotebook) as string
--display dialog "my variable: " & diaryNotebook
tell application "Evernote"
set noteList to find notes (searchQuery)
--open collection window with query string (searchQueryCollection)
if (count of noteList) < 1 then
set newnote to create note title (dateStr) with text " " notebook (diaryNotebook)
open note window with newnote
else
repeat with i in noteList
open note window with i
exit repeat
end repeat
end if
end tell
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment