Keyboard shortcuts for setting due dates?

Is there anyway to quickly set due dates and use the +1 feature with the keyboard?

I’m a 2Do user currently evaluating OmniFocus. 2Do has some great keyboard shortcuts. I can use the shift and arrow keys to select a group of tasks, then use simple keyboard shortcuts to quickly change the start and due dates.

In OmniFocus I like to display only the task list, without the left/right sidebars. But I find myself constantly opening/closing the inspector to do simple things like move a task forward to the next day.

Have you investigated Keyboard Maestro?

Does it help when he wants to have the sidebars closed?

It’s probably more complicated. I’ve no idea if it’s doable. I’m just positing that sometimes you can add shortcuts to perfectly wretched apps this way. (Not that Omnifocus is wretched, mind.) :-)

Keyboard Maestro is an amazing application – I use it all the time and can’t live without it! In this case, though, we would like to click on a button, and then the button has to be visible. Or does anyone has any magic trick for doing it another way?

@ericdr, if you have the Pro version of Omnifocus you might be able to use a script for this. Let me check an old idea and get back to you!

1 Like

Well, maybe not as simple to fix as one would prefer, but it might be of interest for you.

There is a script that could be used to set the defer date to tomorrow (or to dates longer into the future). I guess it would be possible to make it set due date instead, but I haven’t tried.
Defer to tomorrow

There is also a script that seems to work correctly for adding a number of days to existing defer dates. I guess it could be changed to add due dates. When I tried the script on tasks that hadn’t any defer date, the script set tomorrow as defer date, regardless of what number I typed in the dialog box.
Adding defer dates

You could put these and other scripts in the toolbar, but to use keyboard commands to run them, you would need Keyboard Maestro or some other application for creating keyboard shortcuts.

It seems to be easier to use keyboard commands for these kind of things in 2Do…

1 Like

Thanks for the suggestions. I was hoping for a built-in feature that I was just missing. I’m not up for cobbling something together with scripts or other apps, especially since these solutions won’t work on iOS when I have an iPad with a keyboard.

Understandable. Let’s hope for a built-in solution in version 3, planned to the first quarter of next year.

Keyboard Maestro is sadly not available for IOS and will probably never be, as the system wouldn’t allow it to do the tricks it does on the Mac. And I don’t think it could do what @ericdr asked for on the Mac either, as he would like to have the sidebars closed.

Just for reference, I leave this Javascript for Automation script. It doesn’t rely on inspector visibility.

Functionality

  • Adds 1 day to due date of selected tasks and/or projects.
  • If due date is not set, it adds 1 day to current date and sets due date accordingly.

Usage:

  • Select tasks or projects.
  • Run script (if it’s going to be executed through Script Editor, remember to set language to Javascript).
// unlocked2412
// Adds 1 day to due date of selected tasks and/or projects.
// If due date is not set, it adds 1 day to current date and sets
// due date accordingly.

(() => {
	const of = Application('OmniFocus');
	const oDoc = of.defaultDocument;
	const oWin = oDoc.documentWindows[0];
	const seln = oWin.content.selectedTrees.value();

	const validItems = seln.filter(x => {
		return ObjectSpecifier.classOf(x) == 'project' ||
		ObjectSpecifier.classOf(x) == 'task'
	})

	const theDate = new Date()
	theDate.setDate(theDate.getDate() + 1)
	return (
		validItems[0].dueDate() == null ?
		validItems[0].dueDate = theDate : 
		(() => {
			const itemDate = new Date(validItems[0].dueDate())
			itemDate.setDate(itemDate.getDate() + 1),
			validItems[0].dueDate = itemDate
		})()
	)

})();

1 Like

@unlocked2412 Thanks for posting your script!

Is there any way to get it to work for more than one task at a time?

For example, when I highlight two tasks, and then kick off the script, unfortunately, it only ever updates one of the two tasks’ due dates.

Thanks for your help!

You’re welcome.

I think it’s an easy change. Very close to starting a trip now, but I’ll take a look when I come back.

Thanks for your help! @unlocked2412

Yeah, I often have a couple tasks at the end of the day where I’d love to be able to just highlight them both and then kick off your script to add a day to both of their due dates. Thanks!

Hope you have a great trip!

1 Like

Back from my trip. This should work. Now, it updates multiple tasks.

// unlocked2412
// Adds 1 day to due date of selected tasks.
// If due date is not set, it adds 1 day to current date and sets
// due date accordingly.

(() => {
    'use strict';

    // JXA CONTEXT
    // jxaMain :: IO ()
    const jxaMain = () => {
        const selnLR = ofSelectionLR();

        return filter(x =>
            ObjectSpecifier.classOf(x) == 'task',
            selnLR.Right
        ).forEach(x => {
            const taskDate = x.dueDate();
            taskDate == null ? (
                x.dueDate = addDaysToDate(new Date(), 1)
            ) : x.dueDate = addDaysToDate(taskDate, 1)
        })
        return
    };

    // GENERIC

    // JS - Apps

    // addDaysToDate :: Date -> Integer -> Date
    const addDaysToDate = (date, n) => {
        return (
            date.setDate(date.getDate() + parseInt(n)),
            date
        )
    }

    // ofSelectionLR :: () -> Either [OF Task]
    const ofSelectionLR = () => {
        const
            appOF = Application('OmniFocus'),
            ds = appOF.documents;

        return bindLR(
            bindLR(

                // Documents ?
                ds.length === 0 ? (
                    Left('No documents open')
                ) : Right(ds[0].documentWindows),

                // Windows ?
                ws => ws.length === 0 ? (
                    Left('No windows open')
                ) : Right(ws[0].content.selectedTrees)
            ),

            // Selection ?
            seln => seln.length === 0 ? (
                Left('No selection')
            ) : Right(seln.value())
        )
    }

    // JS - Prelude
    // https://github.com/RobTrew/prelude-jxa

    // Left :: a -> Either a b
    const Left = x => ({
        type: 'Either',
        Left: x
    });

    // Right :: b -> Either a b
    const Right = x => ({
        type: 'Either',
        Right: x
    });

    // bindLR (>>=) :: Either a -> (a -> Either b) -> Either b
    const bindLR = (m, mf) =>
        m.Right !== undefined ? (
            mf(m.Right)
        ) : m;

    // filter :: (a -> Bool) -> [a] -> [a]
    const filter = (f, xs) => xs.filter(f);

    // jxaMain
    return jxaMain()
})();
4 Likes

@unlocked2412 It works like a charm. Thanks a ton for all of your help! This is great!!

You’re very welcome, Jason. I’m glad it helped.

I’ve used Omnifocus (pro), Things, Firetask RTM, and 2do. I really want to like Omnifocus, I really do. Things is nice and pretty, but too simple to use for work. Omnifocus … without a major revamp it’s day is done. Version 3 was a tweak, not a revamp, and it really, unfortunately was a flop. Like a major flop. Definitely not worth the dollars to upgrade.

of the list you gave there, OF is the one of the few (not sure for RTM) to have unlimited planning depth. If this is an issue for you, OF is the ONLY option as far as I see it.
Taking on your problem, the shortcut for due dates. I feel you, coming from things. Sadly there are only two options for you in OF, which take getting used to but work similar

  • click on the due date area
  • tab to the due date
    For multiple tasks, the inspector is the fastest method of changing this.

I used BetterTouchTool:
⌘0 is for deferring to today and setting the due date to today.
I just attached 10 single keyboard shortcuts to the command. ⌘’, ⌘’, Tab, Tab, 0, D, Tab, 0, D, Tab

⌘1 is for deferring to tomorrow and setting the due to tomorrow.
Again, 10 single keyboard shortcuts to the command. But this time, just do ⌘’, ⌘’, Tab, Tab, 1, D, Tab, 1, D, Tab

The two ⌘’ brings the focus to the title of the task first, regardless of if you’re editing the title or just selecting the task.

Has this changed or do I still have to spend 20$ for BTT or 40$ on pro to get a keyboard shortcut to set due dates?

This is a huge oversight in my opinion, I thought Things solution was a bit clunky but this is bad.