If then use case

Hi, i'm trying to figure out a way to use If Then Macro (or something similar) to solve an issue using Keyboard Maestro with omnifocus.

I've programmed a macro to use an keyboard shortcut to set a defer date for a task. I've done this by using a menu command "go to inspector" (which is the pane on the right side of the screen), then hitting tab repeatedly until it gets to defer Until.

The issue is that the amount of tabs required to get to Defer Until changes depending on whether i have a main task selected or a subtask selected. In the picture attached, i have a main task selected - so it shows the Type field that is pointed to with red arrow. When a subtask is selected, however, it does not show this field.

I've attached this screenshot to help illustrate the issue:

I have looked into omnifocus menu bar and can't find a better way to do this macro. Is there any way i can use If Then, or any other macro, to make this work right?

1 Like

This would be better done with AppleScript. Are you always setting the task to a specific defer date/time, or a specific set of times? For instance I have an OF palette like this:

Of possible use? Set the Defer Date from the task (not from the Inspector): tab keystroke 4 times puts the insertion point in the Defer Date field for most tasks. NB: Afaict, there is a bug in the program: when the Task Title is displayed on more than one line (for me, anyway), the Completed and Status fields are added in the middle of the tab queue, making it 6 tabs to put the insertion point in the Defer Date field. As @cfriend mentions, AppleScript is a robust solution.

You might find some scripts of use from here: https://discourse.omnigroup.com/t/script-for-setting-defer-date/22093/5

Thanks for the help cfriend and Kirby Krieger!

Yes, it seems that I have mutliple keyboard shortcuts set up in a similar way to you (ie defer 1 day, defer 3 days, etc).

Two questions:

  1. Is it difficult to set up an applescript like this? I have no experience with applescript and little general programming experience beyond using Keyboard Maestro.

  2. With your palette, do you have to mouse click which defer length you want? Or is there a way to set it up so that it works solely with keyboard shortcuts (either with the palette or without)?

What do you mean by Of possible use?

I thought of doing it from the task , but i did notice that the amount of tabs needed depends on if the task or text within the task is selected (and hadn't noticed your one line task title issue). So it doesn't seem like as simple/elegant of a solution.

Just that the information, while apropos, might be — or might not be — useful.

I forgot to mention that you can have KM type an escape keystroke to make the OmniFocus Task selected with no Task data fields selected. This keystroke does nothing when that is the current selection status. This allows you to set the current Task to a "default" state before having KM tab into the Defer Date field (or any Task field).

Btw, the Support Humans (that is what they call themselves) at OmniGroup are helpful. I recommend asking them for suggestions.

2 Likes