Omnifocus Scripts broken - set completed does not work

I am not very deep into scripting - but the lates update broke a lot of my scripts.

What is now the correct syntax to mark a task completed or not completed?
Up till know I have been using “set completed of aTask to true”

But according to the release notes this does no longer work (why?) . ?
-> Scripting — The completed property of a task or project should have been marked as read-only in the scripting dictionary, but was not. Use the mark complete and mark incomplete commands to change the completion status of items.<-

Can someone point me to the right syntax ?

Tagging this thread for follow up.

Just noticed my broken scripts when I woke up (that will teach me to read the release notes in their entirety!!) and will dive into the coding later today. In the first broken script, I don’t even use “mark complete”, I just set a completion date which the dictionary says now “can only be modified on a completed task to backdate the completion date.”

First one to the finish line wins a cookie. :-)

Mini rant: I’d have to check my backups but I’m pretty sure I’ve been using this syntax for YEARS. That an error in the scripting dictionary can exist for this long terrifies me about the future of AppleScript. I have hundreds of scripts with dozens in daily use (everything from a 2-line script to add a keyboard shortcut functionality to thousand-line scripts to edit metadata in media files before importing to iTunes), the death of AS would be a very not fun day for me.

and this is the reason why I deny, when somebody in the forum tells me to use scripts to achieve something special in OF. It is not really reliable.

Old code (broken)
set completion date of lstAllTask to startTime

New code (working)
mark complete lstAllTask completion date startTime

This isn’t the only script where I mark tasks complete, I’ll post any other syntax structures I come across after Cmd-F’ing all my OF scripts. :-)

ETA: Most of my syntax is the same across my scripts that complete tasks. @mapapo in your example, simply changing it to “mark complete aTask” should work.

1 Like

Thanks that did it.
I do not understand the reason for the change - but @ least my scripts are working again

More details here:

1 Like