
毎朝iPhoneで愛用していたMergeEverとMoveEverが使えなくなってしまったので、AppleScriptで同じことを実現しようとしているんだけど、どうもうまくいかない。
やりたいことは、「ライフログアプリで任意のノートブックに作成されたEvernoteの複数のノート(前日分)を結合(マージ)し、ノート名を前日の日付にして別のノートブックに移動(ムーブ)する」。ただこれだけ。

こういう状態で文末のAppleScriptを実行。

結合されたノートのenmlを「display dialog」で確認できているのに、新たに作成されたノートに本文がない。なぜだ?

enmlではなくhtmlにすると本文がある。しかし画像がない。
AppleScriptでEvernoteの画像は扱えないのか? あきらめるしかないのか? AutoEverの代わりになりそうなAppleScriptはすぐ作れたけど。【追記】Pythonを勉強して再チャレンジする。
<MergeEverの代わり>
set date1 to (current date) set date2 to (current date) - (24 * hours) set f_notebook to "50inboxl" as string -- set m_notebook to "51lifelog" as string --* 今日を年月日で分割 set year1 to year of date1 set month1 to month of date1 as number set day1 to day of date1 set date_string1 to "" --* 昨日を年月日で分割 set year2 to year of date2 set month2 to month of date2 as number set day2 to day of date2 set date_string2 to "" --* 今日の文字列取得 if month1 < 10 then set month1 to "0" & month1 as string end if if day1 < 10 then set day1 to "0" & day1 as string end if set date_string1 to year1 & month1 & day1 as string --* 昨日の文字列取得 if month2 < 10 then set month2 to "0" & month2 as string end if if day2 < 10 then set day2 to "0" & day2 as string end if set date_string2 to year2 & month2 & day2 as string --* マージ後のノート名を取得 set new_title to year2 & "/" & month2 & "/" & day2 as string --* Evernoteでの検索文字列 --* (例)notebook:"50inboxl" created:20180329 -created:20180330 set find_word to "notebook:\"" & f_notebook & "\" created:" & date_string2 & " -created:" & date_string1 as string tell application "Evernote" set result_note to find notes find_word set c to 0 as number set new_note to "" repeat with i in result_note set new_note to new_note & ENML content of i -- move i to notebook m_notebook set c to c + 1 as string --* 昨日のノートの削除 -- delete i end repeat if c > 0 then display dialog new_note create note title new_title notebook f_notebook with enml new_note -- create note title new_title notebook f_notebook with html new_note display dialog "昨日のノート" & c & "件をマージしました。" else display dialog "昨日のノートはありませんでした。" end if end tell
<AutoEverの代わり>
set f_notebook to "40inbox" as string set m_notebook to "12mail" as string set find_word to "notebook:40inbox intitle:Fwd: " tell application "Evernote" set result_note to find notes find_word set c to 0 as number repeat with i in result_note move i to notebook m_notebook set c to c + 1 as string end repeat if c > 0 then display dialog c & "件のノートを移動しました。" else display dialog "該当するノートはありませんでした。" end if end tell
コメント