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

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.

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!

1 Like

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:

3 Likes

I have no idea if you are still interested, but I was experimenting with my above script and found the following:

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

    editor.focusedItem = project
}

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

When executed, this will focus your first project. The number in brackets chooses the project.
[1] will select the second project. [2] will select the third project, and so on.

So, if you duplicate this script ten times, and set [0] to the right number for each, and then assign ⌘-1 through ⌘-0 to your ten scripts, I believe you will have your desired switches at your fingertips.

Enjoy!

2 Likes

Very cool, thanks

1 Like

Thanks Jim. I created 5 Keyboard Maestro macros to switch between first 5 projects. Here are the macros if any one is interested.

Screenshot%20of%20Keyboard%20Maestro%20(2-26-20%2C%203-34-22%20PM)

1 Like