set theProgressDetail to""tell application "OmniFocus"tell front documentset theModifiedProjects to every flattened project
repeatwith a from1to length of theModifiedProjects
set theCompletedTasks to (every flattened task of (item a of theModifiedProjects) where its number of tasks =0)
if theCompletedTasks is notequal to {} thenrepeatwith b from1to length of theCompletedTasks
set theProgressDetail to theProgressDetail & completion date of (item b of theCompletedTasks) &returnendrepeatendifendrepeatset theInboxCompletedTasks to (every inbox task where its number of tasks =0)
repeatwith d from1to length of theInboxCompletedTasks
set theProgressDetail to theProgressDetail & completion date of (item d of theInboxCompletedTasks) &returnendrepeatendtellendtelldisplay dialog theProgressDetail
return theProgressDetail
在 Cocoa 中是通过执行如下代码执行:
1
2
3
4
5
let myAppleScript = "I am a piece of applescript"iflet scriptObject = NSAppleScript(source: myAppleScript) {
var error: NSDictionary?
let output = scriptObject.executeAndReturnError(&error)
}