日志
Leave a comment

Ebbinghaus.scpt

omnifocus2升级后,艾宾浩斯记忆曲线的script不能用了.找了omni公司也没解决.

今天遇到一位大神,国内的,提供了新修改代码.十分感谢.(在omnifocus 3中测试通过)

改进的代码还去除了文件夹的限制,可以将任意任务在做任意文件夹中做生成重复任务设置.

下面是下载地址.自取.

链接:https://pan.baidu.com/s/1XKi6QShGy-lK7CiPvHiHWw 密码:5jrj

记录下文章的原始地址:https://kaihao.io/2018/omnifocus-review-with-ebbinghaus/

记录下改进后的代码:

(* 
	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

Leave a Reply