我試圖創建一個AppleScript腳本,將採取的日期形式:的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
在此先感謝!
return me「找不到對象」。編號-1728從日期「錯誤 – 2015-06-12 08:09:44
@ chinna_82它仍然適用於我使用OS X 10.10.3終端上的AppleScript編輯器和osascript。您使用的是什麼OS X版本?是否將代碼文本完全複製並粘貼到AppleScript編輯器?哪行代碼導致錯誤? – 2015-06-12 22:19:41