I wish to insert a task with a specific nested tag. However, when I try to insert the tag, it defaults to the first level. My tag hierarchy is “Communicate : Waiting for…”. I am using this code snippet to insert the task:
property myWFTag : "Communicate : Waiting for..."
set theTag to make new tag with properties {name:myWFTag}
set theTask to make new inbox task with properties {name:theTaskTitle, note:theBody, primary tag:theTag, defer date:theStartDate, due date:theDueDate}
Does anyone know how to achieve scripting for a nested tag?
tell application "OmniFocus"
tell default document
set parentTag to make new tag with properties {name:"Communications"}
set childTag to make new tag with properties {name:"Waiting For"} at end of tags of parentTag
end tell
end tell
tell application "OmniFocus"
tell default document
set parentTag to make new tag with properties {name:"Communications"}
set childTag to make new tag with properties {name:"Waiting For"} at end of tags of parentTag
set theTask to make new inbox task with properties {name:"New Task", primary tag:childTag}
end tell
end tell
Based on your code, seemed like you were trying to create a nested tag and then add a new task with that specific tag.
If you have a parent tag named Communicate with child tag Waiting for..., this should work:
tell application "OmniFocus"
tell default document
set oTag to first flattened tag whose ¬
(name of container = "Communicate") and (name = "Waiting for…")
set oTask to make new inbox task with properties {name:"New Task", primary tag:oTag}
return oTask
end tell
end tell