Quote:
Originally Posted by sputnik
Feeling like an idiot... But at least OmniFocus *does* correctly apply the changes to context & date.
|
AppleScript can do that to me at times too when you sit staring at the code for too long.
I've replicated your project and folder structure (a project called AP, AR, Finance in a folder called Operations & Finance in a folder called Work) in my OmniFocus document and created a sub-context in my Mac context called Online. The following script is working fine for me without any errors. I can select a single item or multiple items in my inbox and they all receive the project, context and due date correctly:
Code:
tell application "OmniFocus"
tell front document
set theContext to the context "Online" of context "Mac"
set theProject to the project "AP, AR, Finance" of folder "Operations & Finance" of folder "Work"
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 assigned container of anItem to theProject
set context of anItem to theContext
set due date of anItem to current date
end repeat
end tell
end tell
end tell
One thing to make sure of is to create a new script to paste the code into otherwise the code from the previous script may be cached until you save the script.
Hopefully this fixes it for you.