思路
- 获取要添加的时间
- 获取OmniFocus显示窗口中的被选task
- 设置task的时间和tag
代码
将下面代码保存为“TaskToKM.scpt”
tell application "OmniFocus"
tell its document "OmniFocus"
set tagKMShare to flattened tag "km-share"
end tell
tell front window
set selTree to selected trees of content
set selTask to value of item 1 of selTree
set due date of selTask to missing value
set defer date of selTask to missing value
set repetition rule of selTask to missing value
set completion date of selTask to missing value
set dropped date of selTask to missing value
add tagKMShare to tags of selTask
end tell
end tell
OmniFocus设置
- 在OmniFocus的help菜单中,选择“Open Script Folder”;
- 将上述代码文件拷贝进去;
- 打开自定义工具栏:
-
- 将其中的“TaskToKM.scpt”图标拖拽到工具栏
测试
选定一个task任务,点击TaskToKM脚本按钮,task被清除所有时间,并被标记tag:
测试之前:

测试之后:
