Drafts 4 是我最常用的文本处理软件,同时也是我的文字处理中枢,但是平时使用电脑和手机阅读、摘抄文章的比例大概是 7:3。由于 Drafts 4 没有 macOS 版本无法在 macOS 上摘抄并且同步回 iPhone 上,我使用提醒事项实现了曲线救国实现了该功能。至于为什么不用 Drafts 5?嗯,不太喜欢它的 UI 设计。

首先需要在提醒事项中新建一个列表:Drafts。接着打开 Drafts 的设置开启「Import Reminders」并且设置「Reminders list」的内容为刚才新建的列表名称,至此 iOS 设置配置完成。

IMG_0265
IMG_

接着需要用到 Keyboard Maestro 新建一个动作指定一个你喜欢的 hotkey,跟上一个 shell 模块,如果你需要的话可以再跟上一个通知来告诉你 shell 代码已执行。shell 代码如下:

#!/usr/local/bin/python3
#-*- coding:utf-8 -*-
#  Clipboard to Reminders.py
#  Clipboard to Reminders
#
#  Created by James Hopbourn on 2019/12/11.
#  Copyright © 2019 James Hopbourn. All rights reserved.

import os
import pyperclip
clipboard = pyperclip.paste()

list = clipboard.split('\n')
name = list[0]
list.remove(list[0])
body = '\n'.join(list)

cmd = """osascript -e 'tell application "Reminders"
    make new reminder at list "Drafts" with properties {name:"namehere", body:"bodyhere"}
end tell'"""
cmd = cmd.replace("namehere", name)
cmd = cmd.replace("bodyhere", body)

def addreminders():
     os.system(cmd)
addreminders()

配置好之后还需要安装 pyperclip 这个模块,如果你的电脑上没有 pip 则需要先安装 pip,操作如下:

安装 pip:sudo easy_install pip
安装 pyperclip:pip install --user pyperclip

配置好之后的效果如图所示,接下来只要选中文本复制后再按下你设置的 hotkey 就可以将这段文本同步回 Drafts 4 了。

屏幕快照 2019-12-11 下午9.47.56
屏幕快照 2019-12-11 下午9.47.

但是考虑到一些用户可能是没有购买 Keyboard Maestro 的,我找 GitHub 上找了一个软件叫做:icanhazshortcut 同样可以绑定 hotkey,配置如图,只要按下 command+B 同样可以执行这段 Python 脚本后台静默把剪切版的文本添加到待办事项的 Drafts 列表中。

摘抄效果:

屏幕快照 2019-12-11 下午9.51.39
屏幕快照 2019-12-11 下午9.51.

导入效果:


IMG_96E76FDE2C33-1
IMG_96E76FDE2C33-