Keyboard shortcut

That’s not a bad accommodation. Thanks for the idea.

1 Like

Something like this ?

1 Like

Yes, though those are built in. What did you make those with? Scriptable? And, nitpicking, I wouldn’t be using toggles like that but rather a menu.

I’ll play with this idea.

No, this is a dialog made with OmniFocus OmniJS Automation. The image was taken with OF iPhone version.

1 Like

Perhaps, using the class Form.Field.MultipleOptions to achieve this kind of dialog:

Screenshot 2021-04-24 at 11.26.28

Screenshot from macOS OF version.

1 Like

That looks nice. Is there a variant where just selecting one immediately executes?

And, how do I make a plugin that works off the share sheet using OmniJS? Which is what appears to be happening here.

Solitary actions, as far as I know, automatically appear in the share sheet.

Depending on your validate function, of course. I mean, if you set a restriction to show the plug-in if the number of selected tasks is greater than zero, then that plug-in is not going to appear in the sheet if no tasks are selected.

1 Like

I think there isn’t a variant like that. You could make separate plug-ins for each one of your most used options, though. Like I did in one of my plug-ins.

I should note that I grouped all those options in a single Plug-In bundle.

1 Like

And just to add to that, I believe now using a plugin bundle is no longer necessary; you can simply stick them in a folder and they will be grouped in the same menu 👍

1 Like

I hate to admit it :-) but I’m not succeeding in getting a task’s Due Date bumped by eg 2 days. The recipes for bumping a javascript Date object by 2 days - as found on the web - give bizarre results.

Would someone mind posting a fragment for bumping a task’s due date by, say, 2 days? And I can take it from there. It’s literally, given a task object in a working plug in, bumping its Due Date. (I’ve got the plug in code otherwise working.)

Thanks!

Sure. Paste this code inside a text file with .omnifocusjs extension. I should this code only show the plug-in available if every task in the selection has a due date.

/*{
	"type": "action",
	"author": "unlocked2412",
	"version": "0.1",
	"description": "Bump a task's due date by 2 days"
}*/
(() => Object.assign(
    new PlugIn.Action(selection => {

        // main :: IO ()
        const main = () => {
            // addDays :: Int -> Date -> Date
            const addDays = n => dte => {
                const dte2 = new Date(dte);
                return (
                    dte2.setDate(n + dte.getDate()),
                    dte2
                );
            };

            const
                ts = selection
                .tasks
                .filter(task => null !== task.dueDate);

            return ts.map(task => {
                const
                    taskDate = task.dueDate;
                return (
                    task.dueDate = addDays(2)(taskDate),
                    task
                )
            })
        };

        // MAIN -----------------------------------------
        return main()

    }), {
        validate: selection =>
            selection
            .tasks
            .filter(task => null !== task.dueDate)
            .length > 0
    }
))();
1 Like

Thank you. Will paste and then dissect.

Update: Works nicely, thank you!

1 Like

That looks very complicated. Is there no such basic functionality in the app itself?

I’m not really into scripting my todo environment.

Form.Field.Option gave me a “pick one from” list. It is a drop down list in Mac OS but not in iOS.

I also note that the share sheet lists the plugin on iOS but not iPad OS. I don’t know if that’s to be expected.

That’s certainly not expected. I can’t reproduce the problem in my iPad.

And then the plug-in seemed to fall off the share sheet on iOS when I tried to drag it too far up the share sheet - in edit mode. Strange. The plug-in is still installed and still working - on Mac, iPhone, and iPad. It also is in the toolbar on Mac.

I should probably copy the code into a new plug-in .omnifocusjs file and see what happens.

I’m reading all the replies but I guess the answer to my question is: No?

I mean do you know how this works in Things? It’s built in, I press Command-S and then I get a window like this where I can also type in free form numbers, days, deltas, whatever.

Screenshot 2021-05-09 at 22.51.07

After seeing this, I switched back to Things and couldn’t be happier.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.