Ken,
Thanks. I think I'm getting closer. Here's the code:
Code:
tell application "OmniFocus"
tell front document
set theContext to the context "Online" of context "Mac"
set ProjectString to "AP, AR, Finance"
tell content of document window 1 -- (first document window whose index is 1)
set theSelectedItems to value of every selected tree
if ((count of theSelectedItems) < 1) then
display alert "You must first select an item to complete." as warning
return
end if
repeat with anItem in theSelectedItems
set context of anItem to theContext
set due date of anItem to current date
set MyProjectArray to complete ProjectString as project maximum matches 1
if ((count of MyProjectArray) > 0) then
set MyProjectID to id of first item of MyProjectArray
set ThisProject to project id MyProjectID
else
set ThisProject to (make project with properties {name:ProjectString})
end if
end repeat
end tell
end tell
end tell
And here is OmniFocus, back to tell me that things are really not shiny.
Quote:
OmniFocus got an error: "AP, AR, Finance" doesn’t understand the complete message.
|