Can I combine multiple built-in commands into one?

I’d like to create a custom command that applies two built-in commands in succession. In this particular example, I’d like to run “Toggle Done”, immediately followed by “Archive Done”.

Is there a way to do this in a custom JavaScript command?

It’s possible, but this is using an undocumented TaskPaper API. I don’t expect it to change, but if you want something more robust you might use AppleScript to automate selecting of TaskPaper menu items.

function TaskPaperContextScript(editor, options) {
	editor.performCommand("outline-editor:toggle-done")
	editor.performCommand("outline-editor:archive-done")
}

Application("TaskPaper").documents[0].evaluate({
  script: TaskPaperContextScript.toString(),
})
2 Likes

That’s perfect - thanks so much! And thank you for TaskPaper!

1 Like

@jessegrosjean — I think I figured out the command for Select All:

 editor.performCommand("outline-editor:select-all")

What is the command for cut?

Keyboard Maestro can combine commands and provide Palettes as well.

Sorry, I don’t think that one is exposed in the same way, for Select All the code just calls directly the to the native NSTextView.

Added to wiki