次の形式で日付を取るapplescriptスクリプトを作成しようとしています:
99/02/20
次に、日付から 5 日を引き、次のような日付を返します。
99/02/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
前もって感謝します!