‘Go to Project’ keyboard shortcut / toolbar icon

Is it possible to have a Go to Project keyboard shortcut or a toolbar icon that will take you to the Project for the currently selected item?

I see other posts asking about this in earlier years, but no solution then. Hoping now it is possible with some setting I have missed or some has done an automation script.

1 Like

There is the arrow button in the inspector, both on Mac and IOS, but I suppose you are aware of that and don’t find it convenient enough.

I’m not in a position to write the code right now but I expect:

  1. The task object has a project property.
  2. Acquiring that property should enable you to switch to it.

I would think this is doable in OmniJS.

Thanks Jan and Martin for the quick replies.

Yes, I was aware of the route via the inspector, but not convenient as you guessed. Though only 3 taps via Inspector, or long press and tap at bottom, I thought there maybe a single/direct method for what I would think is a common need.

Martin, I may have a try at the OmniJS route my self. Thanks for the pointer. Now if it was REXX that would be easier for me. Though I don’t think OmniGroup have done a GDDM client. 😉

1 Like

Aargh! I’m unmasked. :-)

I’m going to have a go myself - as my customer troubleshooting email took less time this morning than I feared. :-)

Here’s a naïve implementation:

/*{
	"type": "action",
	"targets": ["omnifocus"],
	"author": "Martin Packer",
	"identifier": "mglp",
	"version": "1.0",
	"description": "Go to project",
	"label": "Go To Project",
	"shortLabel": "ToProject"
}*/
(() => {
	var action = new PlugIn.Action(function(selection, sender){
		// action code
		project = selection.tasks[0].containingProject
		encodedTaskId = encodeURIComponent(project.task.id.primaryKey)
		aURL = URL.fromString("Omnifocus:///task/" + encodedTaskId)
		aURL.open()

	});

	action.validate = function(selection, sender){
		// validation code
		// selection options: tasks, projects, folders, tags, allObjects
		return (selection.tasks.length > 0)
	};
	
	return action;
	})();
1 Like

Amazing. That works wonderfully, and as a keyboard shortcut as well which is even better.

Thanks so much Martin. This is going to make my OF usage much smoother. 😀🙏👏

1 Like

You’re welcome. It delayed my daily REXX writing, actually, :-) but I realised I wanted the code for myself.

Feel free (anyone) to improve it. It’s got no error checking and isn’t superoptimised. And I don’t much like having to use a URL.

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