用Apple Script备份Evernote

我十分喜欢Evernote,保存了大量的信息在Evernote上,包括一些技术笔记、网页摘录、日记等。这也给我带来了一些麻烦,最近Evernote又一次升级,不知怎么搞的,本地存的笔记全部丢失了,只得重新同步,同步速度非常慢,其实何止慢,简直同步不了,非得用代理,至于具体原因,想必大家都知道。

这次同步之后我就想在本地备份一下Evernote,但Evernote备份起来很困难,自带的界面只能备份单个笔记,不能备份整个笔记本,实在要做的话,可以手工一个一个选择每个笔记,然后备份。麻烦之大,想必须每个懒程序员都不会做,其实何止是程序员,任何正常人都不会这么做。幸运的是,在Mac OS X下,可以借助Apple Script来自动化完成很多工作,当然也包括备份Evernote这类的脏活。我其实没有写过Apple Script,只在[url=http://www.evernote.com/about/developer/mac_scripting.php]这里[/url]发现了类似的脚本,原来的脚本只备份没有同步的笔记本,我去掉了6个单词,使它变成备份所有的笔记本。代码附在文章末尾。只需要打开Apple Script Editor,然后将代码拷贝到里面,然后点击运行便可,运行完成会在Documents的Evernote Local Notebooks Backup目录下看到所备份的笔记,每个笔记本的备份存成一个文件。Apple Script功能之强,真令人印象深刻,今后得空还要好好学习一下。

这样备份之后,仍然不能减少下次升级Evernote之后的同步工作,因为导入时Evernote会创建一个新的笔记本,但至少也可以直到数据安全的作用。或者也可以备份之后删掉那些敏感笔记,这样同步就不会有问题啦。

P.S. 在Windows下所有的笔记都存在单个文件中,直接备份那个文件便可以备份整个Evernote,但若是只想备份某个笔记本就有些困难。


-- EXAMPLE 1
-- Export all local-only notes, creating an archive file for each unsynchronized Notebook

-- we're going to export to "/Users/xxxx/Documents/Evernote Local Notebooks Backup"
set documents_folder to (path to documents folder)
set backup_name to "Evernote Local Noteboooks Backup"

tell application "Finder"
-- make sure the destination folder exists
if not (exists folder backup_name of documents_folder) then
make new folder at documents_folder with properties {name:backup_name}
end if

-- get the full path
set backup_path to (folder backup_name of folder documents_folder as string)
end tell

tell application "Evernote"
-- we're just going to back up unsynchronized notebooks
set local_notebooks to every notebook
repeat with localNB in local_notebooks
set localNotes to every note in localNB
-- export it to our backup folder as "<notebook name>.enex"
export localNotes to file (backup_path & name of localNB & ".enex")
end repeat
end tell
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值