我正在尝试创建一个 applescript 脚本,该脚本将采用以下形式的日期:
99 年 2 月 20 日
然后,从日期中减去 5 天,并返回如下日期:
99 年 2 月 15 日
这是我拥有的基本applescript,但显然,我错过了将日期转换为我可以操作的东西(并将其返回为人类可读的东西)的逻辑。
set itemPath to quoted form of POSIX path of theFile
set dateString to do shell script "awk 'NR == 10 {print $3}' " & itemPath & " -"
set myDueDate to dateString - (5 * days)
set theTask to "Pay AMEX bill"
tell application "OmniFocus"
tell front document
set theContext to first flattened context where its name = "OFFICE"
set theProject to first flattened context where its name = "Bookkeeping - PMS"
tell theProject to make new task with properties {name:theTask, context:theContext, due date:myDueDate}
end tell
end tell
提前致谢!