Add ability to quickly switch open projects with ctrl/cmd + 1/2/3/


#1

I often have quite a few projects I am working on in TaskPaper that I am Focused In on. Like this

48

Currently to switch between them, I have to activate Go to Project... and type out the project I want to jump to. This is awesome. However I really wish you could quickly switch between top active projects (the first 6 at least) with hotkeys.

I would really appreciate having this feature added. As I often am working on multiple projects at same time and want to switch between them super fast and Go to Project... is too slow for me at those times.

Thank you.


TaskPaper Extensions Wiki
#2

I use this script by Jesse to do this with specific projects.

I put that script into Keyboard Maestro as a Execute JavaScript For Automation macro, and duplicate it for each project that I want to switch to and focus on. Of course, I have to edit each script once and type in a specific project title (replacing “Inbox” each time it is referenced in the sample script).

I set a keystroke for each macro, and I am delighted with the results. I can switch focused projects with a simple keystroke. And I can do it with as many projects as I like (eight in my current workflow).

The script also creates the named project if it can’t find an existing one (which is helpful for my workflow). If you don’t like the creation part, you can delete the “if” section from the script, and it will still work as a switch to a focused project macro.

I realize that this isn’t a freeform switch between “top” projects, but if you are willing to implement this, I’ll bet that it serves your needs quite well.

Good luck!


#3

I kept thinking about this, as I am trying to learn more about JavaScript. I came up with a variant of Jesse’s script that will focus a project that contains a string (such as 01, for example). I also removed the code that makes a new project when the search fails, as that wasn’t in your original request.

The script:

function TaskPaperContext(editor, options) {
let outline = editor.outline
let project = outline.evaluateItemPath(’/project 01’)[0]

editor.focusedItem = project

}

Application(‘TaskPaper’).documents[0].evaluate({
script: TaskPaperContext.toString()
});

•••

A demo of the script in action: