No, Brian was saying that there's a AppleScript facility called parse tasks, which was used by the author of the script in the thread he pointed out to you to do something similar. In the mean time, I wrote a post telling you how to do it the harder way :-)
Making an action in the Inbox is pretty straightforward; it's a little more complex when you want to put the action in a project, because you have to specify where it goes.
This will make a task in the Inbox:
Code:
tell application "OmniFocus"
tell default document
make new inbox task with properties {name:"Sample task", note:"This is a short note"}
end tell
end tell
This will look up a context and make a task in the Inbox and assign the context:
Code:
property pContext : "Mail"
tell application "OmniFocus"
tell default document
set MyContext to my GetMyContext(pContext)
make new inbox task with properties {name:"Sample task", note:"This is a short note", context:MyContext}
end tell
end tell
-- Search all contexts for strContext, return first one found with strContext in name. Handles nested contexts.
on GetMyContext(strContext)
tell application "OmniFocus"
tell default document
set lstContexts to flattened contexts where name contains strContext
if (length of lstContexts > 0) then
return (first item of lstContexts)
else
return (missing value)
end if
end tell
end tell
end GetMyContext
Finally, here's one that makes a new task, assigns a context, and installs it in a project:
Code:
property pContext : "Mail"
property pProject : "Miscellaneous"
tell application "OmniFocus"
tell default document
set MyContext to my GetMyContext(pContext)
set MyProject to my GetMyProject(pProject)
if (MyProject is not missing value) then
tell MyProject
set myTask to make new task at end with properties {name:"Sample task", note:"This is a short note", context:MyContext}
end tell
else
make new inbox task with properties {name:"Sample task", note:"This is a short note", context:MyContext}
end if
end tell
end tell
-- Search all contexts for strContext, return first one found with strContext in name. Handles nested contexts.
on GetMyContext(strContext)
tell application "OmniFocus"
tell default document
set lstContexts to flattened contexts where name contains strContext
if (length of lstContexts > 0) then
return (first item of lstContexts)
else
return (missing value)
end if
end tell
end tell
end GetMyContext
-- Search all project names for strProject, return first one found with strProject in name.
on GetMyProject(strProject)
tell application "OmniFocus"
tell default document
set lstProjects to flattened projects where name contains strProject
if (length of lstProjects > 0) then
return (first item of lstProjects)
else
return (missing value)
end if
end tell
end tell
end GetMyProject