Script to select random task from current perspective - on iOS

Hi

I use this script almost daily in Omnifocus on my Mac - and I love it:

Is it possible to get the same functionality on my iPhone with a plugin? Or are there limitations that prevent obtaining the number of tasks in the current perspective on Ios?

Which OmniFocus version are you using on your iPhone ?

Version 3. I will update to 4 when its available.

Do you know if it possible in some way to pick a random task on the phone?

Sometimes when my Mac is not available, I manually count the number of tasks in my perspective on the phone and use a random number shortcut on my phone to pick a random task. If i get 1 its the first task, and if its 2 its the second task and so on.

I would love to use automation to avoid this tedious process 😅

I can’t test because I am using OmniFocus 4. However, I can give you an idea. You can access the root TreeNode for the tree that this node belongs to with:

document.windows[0].content.rootNode

That object has a children property (to obtain a list of top-level descendants of type TreeNode).

You can generate a pseudo-random number using Math.random() method. With this, in turn, you could use it to derive a random OF task.

I hope that is useful. Not sure what’s your current programming level.

Thank you. Im no programmer, but i will give it a go with chatGPT.

1 Like