Evernote 2.2 Beta1 for Macでノートリンク機能が追加されました。
これはノートのURLを取得して、利用することができる機能です。
メニュー:編集→ノートリンクを実行すると、選択中のノートのURLを取得することができます。これをノートや他のアプリで利用することができます。
リンクをノートに貼り付けると、ノートのタイトルが表示されて、属性としてリンクが付きます。
ノート間で行ったり来たりできるようになるので、より使いやすいノートを作成することができるようになります。
他のアプリからもノートを参照できるようになるので、たとえばOmniFocusのタスクからEvernoteのノートを参照することもできるようになるので。さらにEvernoteの利用法が広がりそうです。
リンクは「evernote:///view/1307184/s11/a9bc7f7c-31cd-4767-9959-91201f75726a/a9bc7f7c-31cd-4767-9959-91201f75726a/」の形式になるので、Webインターフェースからこのリンクをクリックすると、Macクライアントが起動してノートが表示されます。Webインターフェース内での移動にはならないので注意が必要です。
ちなみに新しいノートは同期するか、ローカルノートブックに属していないとリンクが取得できません。
現在はAppleScriptからはノートリンクは取得できないようです。将来的には取得できるようになってほしいですね。
以前からOmniFocusとEvernoteの連携で、EvernoteのノートURIが存在しないのできないと考えていたのですが、OmniFocusのタスクのURIは取得できるので、それを使えばいいじゃないかということで、いくつかAppleScriptを書いてみました。
まず、Evernoteノートを作成するスクリプトです。
新規にノートを作成して、タイトルにタスクのname、ソースURLにタスク(プロジェクト/フォルダ)URIを記入、タグにプロジェクト名を設定、本文にタスクURIとOmniFocusタスクのノートを記入します。本文にもURIを記入するのは、EvernoteでのソースURLの検索方法が無いみたいだからです。
tell front window of application "OmniFocus"
try
set theTrees to selected trees of content
if (count of theTrees) < 1 then
set theTrees to selected trees of sidebar
end if
if (count of theTrees) < 1 then
return
end if
set theSelection to value of item 1 of theTrees
if class of theSelection is folder then
set theURI to "omnifocus:///folder/" & id of theSelection
set theNote to ""
else if class of theSelection is project then
set theURI to "omnifocus:///project/" & id of theSelection
set theNote to ""
else
set theURI to "omnifocus:///task/" & id of theSelection
set theNote to note of theSelection
set theProjectName to name of containing project of theSelection
end if
set theName to name of theSelection
tell application "Evernote"
set newNote to create note with text theURI & return & theNote
set title of newNote to theName
set source URL of newNote to theURI
if (count of theProjectName) > 0 then
if (not (tag named theProjectName exists)) then
make tag with properties {name:theProjectName}
end if
set theTag to tag named theProjectName
assign theTag to newNote
end if
open note window with newNote
activate
end tell
end try
end tell
次にタスクURIをクリップボートに取得するスクリプトです。取得したURIは、既に存在するEvernoteノートに貼り付けるといいです。ソースURLにだけでなく、本文にも貼り付けておかないとURIで検索できません。
tell front window of application "OmniFocus"
try
set theTrees to selected trees of content
if (count of theTrees) < 1 then
set theTrees to selected trees of sidebar
end if
if (count of theTrees) < 1 then
return
end if
set theSelection to value of item 1 of theTrees
if class of theSelection is folder then
set the clipboard to "omnifocus:///folder/" & id of theSelection
else if class of theSelection is project then
set the clipboard to "omnifocus:///project/" & id of theSelection
else
set the clipboard to "omnifocus:///task/" & id of theSelection
end if
end try
end tell
そして、上記二つのスクリプトで作成したEvernoteをタスクURIで検索するためのスクリプトです
tell front window of application "OmniFocus"
try
set theTrees to selected trees of content
if (count of theTrees) < 1 then
set theTrees to selected trees of sidebar
end if
if (count of theTrees) < 1 then
return
end if
set theSelection to value of item 1 of theTrees
if class of theSelection is folder then
set theURI to "omnifocus:///folder/" & id of theSelection
else if class of theSelection is project then
set theURI to "omnifocus:///project/" & id of theSelection
else
set theURI to "omnifocus:///task/" & id of theSelection
end if
tell application "Evernote"
open collection window with query string theURI
activate
end tell
end try
end tell
EvernoteでURLの検索ができればいいのですが…。
ついでに、OmniFocusのプロジェクト名をEvernoteタグにしているので、プロジェクト名でタグを検索するスクリプトです。なんでもNozbeではプロジェクト名とEvernoteのタグが連動するらしいので、同様の機能をAppleScriptで実現しました。複数プロジェクト名での検索には対応してません。
tell front window of application "OmniFocus"
try
set theTrees to selected trees of content
if (count of theTrees) < 1 then
set theTrees to selected trees of sidebar
end if
set theSelection to value of item 1 of theTrees
if class of theSelection is folder then
set theQuery to "tag:" & name of theSelection
else if class of theSelection is project then
set theQuery to "tag:" & name of theSelection
else
set theProject to containing project of theSelection
if theProject is equal to missing value then
return
end if
set theQuery to "tag:" & name of theProject
end if
tell application "Evernote"
open collection window with query string theQuery
activate
end tell
end try
end tell
どのスクリプトもできたてホヤホヤでテストが不十分ですので、バグがあればコメントよろしくです。
Mail.appからOmniFocusに追加してくれるから、Evernoteを挟む必要はないので、なんの役に立つかは分からないけど作ってみた。まぁfind notesのテストみたいなもの。
Evernoteの特定のノートブック(ここではOF)にあるノートをもとにOminFocusのInboxにタスクを作成して、ノートを削除する。
tell application "Evernote"
set matches to find notes "notebook:OF"
repeat with n in matches
set theTitle to title of n
set theContent to HTML content of n
tell application "OmniFocus"
tell front document
make new inbox task with properties {name:theTitle, note:theContent}
end tell
end tell
delete n
end repeat
end tell
問題はコンテンツがHTMLだということ。OFがタグまで表示してくれちゃう。Evernoteからテキストなコンテンツがとれるといいのに。
Evernoteのfind notesは結構時間がかかる。ので、notebookを指定して検索対象を少なくするといい。
LaunchBarからOmniFocusの同期動作を実行したいので、AppleScriptスクリプトを作成。
tell application "OmniFocus"
synchronize document 1
end tell
期限迄に終わらなかったタスクの期限を明日に設定(延期)するスクリプト。
期限迄に終わらせろよという突っ込みは無しで・・・。
tell application "OmniFocus"
tell front document
tell document window 1
set theSelectedItems to selected trees of content
set tomorrow to (current date) + 1 * days
repeat with theItem in theSelectedItems
set theTask to value of theItem
set dueDate to due date of theTask
if dueDate is not missing value then
if dueDate < tomorrow then
set due date of theTask to tomorrow
end if
end if
end repeat
end tell
end tell
end tell
OmniFocus 1.5のクリッピングにショートカットキーを設定してもまったく動作しないので調べてみた。
結局英語環境で設定したら動いたので、日本語環境の問題らしい。というわけでOmniGroupにレポートを送ったら、fixリクエストに追加してくれた。
OmniFocusが起動しているときの
「OmniFocus 書類を開いている」
という表示を見るたびに、なんで「開いています」じゃないの?と思うんです。
で、
/Applications/OmniFocus.app/Contents/Resources/ja.lproj/Localizable.strings
の
“Opening OmniFocus document” = “OmniFocus 書類を開いている;
を「開いています」に修正してみました。
スッキリしました。
OmniFocusを使い始めて半月くらい。
コンテキストをどう使って良いのやら分からなかったのが、やっと分かってきましたよ。
つまり近所の酒屋とかを登録して、小包の発送アクションのコンテキストに指定すれば良いんですよね。
で、問題が。
同じコンテキストでも仕事とプライベートがあるのに、コンテキストはiCalカレンダーの仕事関係にバインドしてあるという事が発生したわけですよ。
カレンダーの方の分類を検討すべきなのか、コンテキストの分類をもっと細かくすべきなのか。
現在悩み中・・・。
OmniFocusに決まった手順の作業を登録するときに毎回同じ事を入力するのは面倒なので、AppleScriptで自動化してみました。
front documentから入れるフォルダを得て、フォルダにプロジェクトを作成、さらにそのプロジェクトにアクションを作成、さらにさらにアクションにサブアクションを作成、というように追加していきます。
tell application "OmniFocus"
tell front document
set aFolder to folder "或フォルダ"
tell aFolder
set oProj to make new project with properties {name:"プロジェクト名"}
tell oProj
set oTask to make new task with properties {name:"アクション1"}
tell oTask
make new task with properties {name:"子アクション"}
end tell
make new task with properties {name:"アクション2"}
end tell
end tell
end tell
end tell