Script to toggle Contexts between Active and On Hold

I searched for a while, and some topics have hinted at or come tantalizingly close to a solution, but I can’t seem to find what must be an easy one… hopefully someone can point me in the right direction…

I’d like a script to quickly toggle a specific context (or set of contexts) between Active and On Hold. Is this possible?

To get into the details… I have a new Dashboard setup. I typically have my “Pending” context (ie, what others might call Waiting or Delegated) set to Active. Most of the time, I like to see these tasks in various perspectives; I also use flags and due dates, so Active is preferred.

However, in this new Dashboard set up, I’d like the option to include the “Pending” tasks or not. Thus the desire to easily and quickly toggle between Active and On Hold.

In my specific set up, there is actually a single parent context, with several sub- and sub-sub-contexts. I’d like a script to place them all on hold. When manually placing them on hold, I need to select them all (versus just the parent). Not sure how the script needs to specify them.

– Pending
— Sub-Pending 1
---- Sub-Sub-Pending 1
— Sub-Pending 2
---- Sub-Sub-Pending 2

etc etc

Many thanks to anyone who can help or offer guidance!

Here is an example that may help you further.

Unfortunately, you have to go through all sub- and sub-sub- and … contexts to set their status. The status of the parent (active versus on hold) stands by itself. Changing its state does not alter the state of the children.



Thanks! I’ll give this a go. I’m a super novice at scripting, but this looks simple enough to figure out and edit. Appreciate it!

@DrJJWMac -

I just want to thank you for your reply and your sharing your script. This did the trick!

I finally had some time to try this out, and after just a little fiddling, it worked perfectly. Many thanks!


ps -

As a side note to others who may find this. I actually found a much older thread with DrJJWMac, which noted that the script will treat all same-named contexts the same. In my case, all of my sub-contexts are identically named under people’s names. For example, a my current set of sub-contexts are:

– Wife
---- With
---- Delegated

– Kids
---- With
---- Delegated

– Boss
---- With
---- Delegated

In my script, I just listed “With” and “Delegated” to pause/activate all of them. Easy!

I remember this coming up in a Hazel script I made to create tasks from files. I don’t know if / how one can deal distinctly with contexts of the same name, but I did not have to do so here.

Anyway, perhaps this is easy knowledge for those used to working in AppleScript, but I’m a total amateur, so it was very helpful.

Glad to hear this was helpful.


I’m finally able to test OF3. One of the first things I’ve tried is to run this script, but it doesn’t seem to work.

Has there been a change in the scripting in reference to tags? How do I convert this script that references “contexts” to one that references “tags”?

Or am I missing some easy here?

Thanks for any and all help!

I am waiting to update to OF3 until later for various reasons.

I wonder if the change is as easy as changing all cases of contexts to tags.


Good point! I’ll try when I can. I hope it’s that easy!

Though I spoke too soon. A bug with one of my perspectives has reappeared, and I’m back in contact with Support. It makes OF3 difficult to use, so I’m back to OF2 until that’s sorted.

I’m curious what your reasons for waiting are, if you don’t me asking. That is, if it’s related to the software itself (rather than personal - such as, say, not having the time to switch systems right now).

I am hesitant to switch b/c I do not trust that I will loose access to things that I must have in my workflow. Applescripts are one factor. I depend on a few different ones. The Toolbar is another. I have an entire row that sets how I work …

… and I understand this is not possible to have in OF3.

In a nutshell, I fear this will be another example of what I experienced in watching the OF1 -> OF2 update. You (the user) gain but we (OmniGroup) will take away things you needed in the meantime.

I am in no rush to enjoy multiple tags just to find that I have to spend three to six months to recalibrate my workflow, not so much to account for what has changed but rather to mourn the loss of what has been taken away.


I’m pretty sure you can do that toolbar in OF3, @DrJJWMac. What isn’t there in OF is the text label for toolbar things, but looks like you don’t use that anyway?

Not pushing or anything, just thought I’d clarify. 😁


Good to hear! It may therefore only depend on the need to recalibrate my AppleScript workflows.

Seems like an update may be on order for far sooner than I thought.

Again, I’m greatly obliged for the news!


A earlier version didn’t have availability of things in the toolbar, but it’s since been added back. So you weren’t wrong. 😉