View Single Post
Quote:
Originally Posted by RobTrew View Post
set theResult to parse tasks with transport text unicode text

is agnostic with regard to the source of the unicode text.

-- Action > Project @ Context

If your theText variable only contains the name of the action, you simply need to append the name of a project, preceded by > and/or the name of a context preceded by @

If there are multiple actions, each new one should start with "--" at the beginning of the line.

--

So when OF parses the text that is passed to it no matter from were if it encounters a > then it assigns the following text to the Project and like wise for the context. Now for some clarification... I have added the two lines in red below to my script. I am now getting an Omnifocus Applescript error : "Can't make Unicode text into type rich text". I tend to learn coding by example and I have yet to find any examples of where the project is added in this way. Thanks again for you help.


set my text item delimiters to return
set reqLines to reqLines as text -- convert the list back to text
set my text item delimiters to od -- clean up
set theText to text 2 through end of reqLines
set theText to theText & ">" & defaultProject
tell application "OmniFocus"
set MyDoc to default document
tell application "OmniFocus" to tell MyDoc
set singleTask to true
set theText to parse tasks with transport text Unicode text
--set MyDoc to parse tasks with transport text theText as single task singleTask
set start date of first item of MyDoc to (current date) + 1 * days
set due date of first item of MyDoc to (current date) + 4 * days
end tell
end tell