OmniFocus中根据艾宾浩斯遗忘曲线快捷添加复习任务

OmniFocus中需要根据艾宾浩斯遗忘曲线来添加多个任务。找了下网上的AppleScript,基本上因为版本太老不能正常使用,于是自己简单写了一下。

使用方法:选中一个或多个任务后,运行程序可生成若干个同样名称的复习任务。复习任务的“推迟至”时间按照艾宾浩斯的记忆曲线来设定,可以自行在AppleScript中修改。

另外也可以设置“截止时间”,即“推迟至”时间后的若干天。若该天数设置为负,则代表不设置截至时间。

程序下载地址

安装方法是在macOS中打开OmniFocus,选择菜单栏中的“帮助”→“打开Scripts文件夹”。将下载后的文件解压,得到的scpt文件复制到该文件夹中。之后右键OmniFocus工具栏,将“Ebbinghaus” Script拖进工具栏。之后点击“Ebbinghaus”即可运行AppleScript。

当然,也可以采用Alfred、Keyboard Maestro等工具运行AppleScript。

下面是AppleScript具体内容。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(* 
Schedule tasks for reviewing material in spirit of Ebbinghaus forgetting curves
by Kaihao, August 2018
https://kaihao.io/2018/omnifocus-review-with-ebbinghaus/

Revised from Curt Clifton's "Complete and Await Reply" script(http://curtclifton.net/complete)
*)

# Number of defer days
property deferIntervals : {1, 2, 4, 8, 16, 32}

# Number of days from defer date that the newly created "review" action will be due. Set to a negative number to put no due date on the new action.
property daysUntilDue : -1

set itemTitle to missing value
tell application "OmniFocus"
tell front document
tell content of document window 1 -- (first document window whose index is 1)
set theSelectedItems to value of every selected tree
if ((count of theSelectedItems) < 1) then
display alert "You must first select an item to complete." as warning
return
end if
set reversedDeferIntervals to reverse of deferIntervals
repeat with anItem in theSelectedItems
set itemTitle to name of anItem
repeat with i from 1 to (length of deferIntervals)
set theDupe to duplicate anItem to after anItem

-- Set defer date
set deferForDays to item i of reversedDeferIntervals
set deferUntilDate to current date
set time of deferUntilDate to 0
set deferUntilDate to (deferUntilDate) + deferForDays * days
set defer date of theDupe to deferUntilDate

-- Set due date
if (daysUntilDue < 0) then
set due date of theDupe to missing value
else
set due date of theDupe to (defer date of theDupe) + daysUntilDue * days
end if
end repeat
end repeat
end tell
end tell
end tell