Are there any examples of how to set a nested context from the scripting interface? E.g., Work->Email
Thanks,
Don
Thanks,
Don
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!
|
|
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
Setting nested context from script | Thread Tools | Search this Thread | Display Modes |
Guest
2007-08-10, 02:40 PM
Are there any examples of how to set a nested context from the scripting interface? E.g., Work->Email
Thanks, Don
Post 1
|
Guest
2007-08-13, 01:42 PM
You need a reference to the corresponding element in the contexts tree of the document
One way would be something like: Code:
tell application "OmniFocus" set oContextList to contexts of first document set oContext to my FindContext("Email", oContextList) -- ... -- Assume creation of, or reference to an Omnifocus task (oTask) somewhere here -- ... set context of oTask to oContext end tell -- get a pointer to any defined context with this name on FindContext(strName, oContexts) tell application "OmniFocus" ignoring case repeat with oContext in oContexts -- set strContextName to name of oContext if (name of oContext) = strName then return oContext else set oSubContexts to contexts of oContext if (count of (oSubContexts)) > 0 then set ContextFound to my FindContext(strName, oSubContexts) -- Check whether a context has in fact been found try set SomeName to name of ContextFound return ContextFound end try end if end if end repeat end ignoring end tell end FindContext
Post 2
|
Guest
2007-08-14, 01:43 AM
Probably quicker, in fact, to use the verb "Complete" which is provided in the Omnifocus applescript dictionary, and which will find nested contexts directly.
Code:
tell application "OmniFocus" tell first document set oTask to make new inbox task with properties {name:"Testing"} try set context of oTask to my FindContext("Email") end try end tell end tell on FindContext(strContext) tell application "OmniFocus" tell first document set oContextList to complete strContext as context maximum matches 1 if (oContextList is {}) then else return context id (id of item 1 of oContextList) end if end tell end tell end FindContext
Post 3
|
Guest
2007-08-14, 02:54 AM
Finally, if you had two nested contexts with the same name, e.g.
Work > Emailand Home > Emailyou could specify the particular path by using a colon as a separator. For example, using the FindContext() function defined in the previous post: Code:
try set context of oTask to my FindContext("Work:Email") end try
Post 4
|
Member
2011-09-16, 12:22 PM
I would like to use Applescript to add a task with nested contexts (a task with the context people:keith). I have been unable to discover how to do this.
Any help would be appreciated.
Post 5
|
Menza, I'm going to move your post to an existing thread which has the info you're looking for. Responding in the thread you created before I do that so you get any notifications you signed up for.
Post 6
|
Thread Tools | Search this Thread |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
setting project + context via script (modifying a DEVONthink script) | bernd | OmniFocus Extras | 2 | 2012-09-08 12:10 PM |
Nested context view | calumma | OmniFocus for iPad | 1 | 2011-08-16 03:56 PM |
Nested context/project separator | constructor_trurl | OmniFocus for iPad | 2 | 2011-05-28 11:42 AM |
Nested On-hold Context + On Hold Context Filter: expected results? | ringods | OmniFocus 1 for Mac | 9 | 2010-10-21 06:51 PM |
Creating a New Nested Context | SpiralOcean | OmniFocus 1 for Mac | 8 | 2007-07-18 07:55 PM |