Using AppleScript to find available tasks

Hi. I’m not particularly familiar with AppleScript and have never used it to work with OF, but I’m trying to modify a Übersicht widget that shows flagged tasks to limit the output to only tasks which are available. Here’s the specific code for the function:

function getFlaggedTasks(){
taskList = [];
tasks = doc.flattenedTasks.whose({completed: false, flagged: true})();
var today = new Date();
	if ( (!task.deferDate()) || (today > task.deferDate()) ) {
		context = (task.context() !== null) ? task.context().name() : '';
		project = (task.container() !== null) ? task.container().name() : '';
			context: context,
			project: project,
			note: task.note(),

I’ve tried adding “available: true” in the line that has “doc.flattenedTasks.whose({completed: false, flagged: true})();” but that didn’t work.

Would someone be willing to help me out here? I’m also OK with chasing it down myself if someone can point me in the right direction.


I’m afraid I can’t help you really, but this is JavaScript - not AppleScript. That will probably get you the information you are looking for faster.

I’ll guess based on this post, you need “blocked: false” after flagged.

Hi, and thank you for responding. I recognize that it looks like JavaScript but without being familiar with AppleScript, I just assumed they were very similar. The only examples of AppleScript I’ve seen look a lot more like plain English, so that makes a lot more sense now.

On a related note, the person in the link you shared is trying to make modifications to the same thing I am, so that’s super helpful. I swear I searched first – thank you for sharing the link!