View Single Post
I am trying to run the modified "no quick entry" version of this script from within a rule. I am mailing myself on delegated tasks and have created a rule which runs this script and assigns a context of waiting for. Unfortunately the script gives me the following error:

While processing message "Test" (ID 8268), the rule "waiting" could not be successfully executed. The script encountered error "Can’t get item 1 of {}." during execution.

I am trying to combine tarun101's delegated tasks script with the one posted here and can't figure out why I get the error. What I am trying to do is create a script for mails I delegate to others by copying myself and which will create a task in OF with attached mail - the script must run from a rule.

Here is tarun101's script (see http://forums.omnigroup.com/showthread.php?t=9171 for more details)

tell application "Microsoft Entourage"

-- get the currently selected message or messages
set selectedMessages to current messages

repeat with theMessage in selectedMessages

-- parse the email(s)
set theName to subject of theMessage
set theContent to content of theMessage


tell application "OmniFocus"
set theContext to context "Waiting" of default document
set theTask to theName
set theNote to theContent

tell default document to make new inbox task with properties {name:theTask, note:theContent, context:theContext}
end tell

end repeat
end tell