使用Evernote命令行工具ENScript.exe快速搜尋記事標題

最近一直在用Evernote記筆記,絕大部份都是開啟兩個以內的記事在用,每次都要開啟Evernote主視窗、找到記事(雖然用更新日期排序,但有時要用的記事還是不一定排在最上面)再雙擊或按〔Ctrl+Enter〕開啟記事為獨立視窗,再拖到另一個螢幕以方便參考或撰寫筆記,雖然只是幾個小步驟,但每天都要執行,還是覺得有點煩人,搜尋了一下看有沒有稍微方便些的方法,最後使用Evernote的ENScript.exe寫了批次檔和AutoHotkey腳本,簡化了一些搜尋記事的時間。

命令行工具ENScript.exe

ENScript.exe是Evernote的命令行工具,提供了下列功能:

執行參數 功能
enscript createNote 建立新記事
enscript importNotes 匯入記事
enscript showNotes 在主視窗顯示記事
enscript printNotes 列印記事
enscript exportNotes 匯出記事
enscript createNotebook 建立記事本
enscript listNotebooks 列出記事本
enscript syncDatabase 資料庫同步

只要在上述命令加上「/?」就能顯示命令的參數說明,我要用的搜尋記事是使用showNotes,其參數如下:

C:\Program Files (x86)\evernote>ENScript.exe shownotes /?

Usage: ENScript showNotes [options]

Options:

  /q query - query to filter the notes. If omitted, stdin is used to gather query specification.
  /u username - user name if not the same as database file name.
  /p password - user password to confirm Evernote service access.
  /d database - database file name if user name is not specified.

If both database file name and user name are not specified, last login name is used and
if there is none, USERNAME environment variable value is used as a user name.

/q 後面接的是搜尋字串,其格式的完整語法可以參考Search Grammar,我要用的是搜尋標題,寫成的 ev.bat 內容如下,用「intitle:」來搜尋標題,%*是傳遞給ev.bat的所有命令行參數:

echo tag:TAG, intitle:TITLE, created:day-5, updated:20141210
"C:\Program Files (x86)\evernote\ENScript.exe" showNotes /q "intitle:\"%*\""

使用範例:

d:\util>ev Windows
echo tag:TAG, intitle:TITLE, created:day-5, updated:20141210
"C:\Program Files (x86)\evernote\ENScript.exe" showNotes /q "intitle:\"Windows\""

AutoHotkey腳本

另外也寫了AutoHotkey腳本,以〔Alt+V〕執行:

!v::
  InputBox, SEARCH, Search, Please enter search text:`n`n tag:TAG / intitle:TITLE / created:day-5 / updated:20141210, , 550, 200
  _iLen := Strlen(SEARCH)
  ;;Msgbox %_iLen%
  if (_iLen = 0) {
    return
  }
  run "C:\Program Files (x86)\evernote\ENScript.exe" showNotes /q "%SEARCH%"
  return

需要搜尋記事時只要按下〔Alt+V〕就會彈出對話窗讓我輸入搜尋字串。
Alt+V

參考網址

##

您可能也會有興趣的類似文章

簡睿

服務於軟體業的資訊老兵。興趣廣泛,學習力佳,樂於分享所知所學。

您可能也會喜歡…

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *