Trigger AppleScript by completing an OmniFocus task

Complete a task in Omnifocus triggers a script. Anyone know if this is possible?

I want to automatically create a receipt in pages which is PDF and emailed when I complete a repeating task. I can do this part with AppleScript. Just need to trigger the script when I mark the task completed.

I do not believe that “event hooks” are open in OF. My approach would be to create an AppleScript that completes the selected task and then does whatever else is desired.

The AppleScript can reside in the task bar of OF. One click does what is needed.

When scripting is open to both macOS and iOS, you can run the script on your iOS and have it do something there too.


JJW

2 Likes

Thanks for that. I will play around with it. I was really hoping and kind of expecting this was possible, it seems it would be so elegant and transparent especially to someone who has used omnifocus for a long time - it would just work in the background. Perhaps something I will push to Omnigroup.

Hello namesake (@Mpacker). :slight_smile:

The idea of being able to write a line to my daily log in Drafts when I complete a certain kind of task in Omnifocus is attractive to me.

You don’t say whether your need is on iOS or Mac OS or “don’t care which”. I’m told the API improves soon so it might be possible to grab a task in a Shortcut, copy its text to Drafts and then mark it completed.

But I’m just speculating.

Hi Fellow M Packer!

Mac OS, because I would be using AppleScript to create a PDF from a Pages document. I would envisage that if the task was completed in Omnifocus for iOS, once that task completion was synced to the Mac the script would run. If the Mac wasn’t running at the time it would run the script when it caught up.

I am really not up to speed on iOS shortcuts but have bought the field guide and hope to get up to speed really soon!

For now I will just make tasks that remind me to run the applescripts manually.

Could the answer - as it’s MacOS - be to write an AppleScript that does the two things, rather than attempting to be triggered by one of them (the Omnifocus task completion)?