Is it possible to jump instantly to a project inside TaskPaper doc

I want to create a KM macro that will jump to a certain project and focus in on it. Basically what the Go to Project.. search does but without triggering the palette.

So I can run it from my browser and it switches to TaskPaper with the specified project in focus.

Is this possible to do?

You can do this with AppleScript by setting focusedItem on the OutlineEditor.

@jessegrosjean — can you show an example AppleScript to focus Inbox?

This script focuses top level “Inbox” project. If such a project doesn’t yet exist it creates it, and then focuses it.

function TaskPaperContext(editor, options) {
	let outline = editor.outline
	let inbox = outline.evaluateItemPath('/project Inbox')[0]
	if (inbox == null) {
		inbox = outline.createItem('Inbox:')
		outline.root.insertChildrenBefore([inbox], outline.root.firstChild)
	}
    editor.focusedItem = inbox
}

Application('TaskPaper').documents[0].evaluate({
  script: TaskPaperContext.toString()
});
2 Likes

Thanks @jessegrosjean!

Edit: I set this up for a few projects and have been using it this afternoon—I love it! Kudos!