How to create 'top level' project?

I want a hotkey that will always create a ‘root’ level project for me. I can’t figure out how to do it.

For a lot of your questions you might look at this Alfred workflow which contains code to do a lot of what you’d like:

and if you are interested in fine-tuning things for yourself, you could turn to:


to polish up rough drafts like this:

(() => {
    'use strict';

    const main = () => {
        const tp3Context = (editor, options) => {
                outline = editor.outline,
                root = outline.root;

            return (
                outline.groupUndoAndChanges(() => {
                editor.moveSelectionToItems(root.lastChild, 0),
                'Root level item created.'

            tp3 = Application('TaskPaper'),
            ds = tp3
            lrResult = bindLR(
                ds.length > 0 ? (
                ) : Left('No TaskPaper documents open'),
                d => Right(d.evaluate({
                    script: tp3Context.toString(),
                    withOptions: {
                        optionName: 'someValue'
        return (

    // GENERIC FUNCTIONS ----------------------------

    // Left :: a -> Either a b
    const Left = x => ({
        type: 'Either',
        Left: x

    // Right :: b -> Either a b
    const Right = x => ({
        type: 'Either',
        Right: x

    // bindLR (>>=) :: Either a -> (a -> Either b) -> Either b
    const bindLR = (m, mf) =>
        undefined !== m.Left ? (
        ) : mf(m.Right);

    // MAIN ---
    return main();

1 Like

Thank you @complexpoint. I expanded on it to in a hacky way do what I want. It’s not perfect and takes about 2 seconds just to make a new project but it’s better than nothing.

Here is the macro I came up with:

@jessegrosjean Is it possible to add a hotkey to add a root level project to TaskPaper 4?

Would really love to have it.

The problem is that your script is waiting around to automate the “Go to Project” dialogue. Instead you can just “Go to Project” in your script directly by setting “focusedItem”. Here’s an example:

function TaskPaperContext(editor, options) {
	let project = editor.outline.createItem('New Project:')
	let root = editor.outline.root
	editor.focusedItem = project
	editor.moveSelectionToItems(project, 0, project, 11)

  script: TaskPaperContext.toString()

TaskPaper 4 is still in the someday in future stage. So I’m not sure what will be in it, but I don’t expect I’ll add a specific hotkey for inserting project at top level. Instead of many shortcuts I think it’s best to have a few that people can remember really well… and a scripting API that allows people to build their own shortcuts.

As things are now to create new top level project you can:

  1. Command-Shift-H (Go home)
  2. Press Return to clear line for new project.
  3. Press Up Arrow to go into cleared line.
  4. Type project name followed by colon.

It’s not a single shortcut, but it requires no mouse, and is just a few standard (except for “Go Home”) text editing commands. For general use I don’t think it’s worth it to add a shortcut that makes is faster.


Perfect. Thank you a lot for the above script.

I definitely agree this is a much better approach.

@jessegrosjean — thank you for these example! Since I have yet to dig heavily into JavaScript, I hope you can tell me how to:

  • Make New Project appear at the top of the document (right now, it appears at the end of the document—even after Archive:)
  • How would I add default tasks under New Project?

Here’s a quick modification that does it:

function TaskPaperContext(editor, options) {
	let outline = editor.outline
	let project = outline.createItem('New Project:')
		outline.createItem('- a'),
		outline.createItem('- b'),
		outline.createItem('- c')
	let root = editor.outline.root
	root.insertChildrenBefore(project, root.firstChild)
	editor.focusedItem = project
	editor.moveSelectionToItems(project, 0, project, 11)

  script: TaskPaperContext.toString()
1 Like

Thank you so much! Being able to compare these two is extremely helpful!

I intuitively “get” AppleScript. JavaScript is proving more challenging. For example, before your post, I was trying root.prependChildren(project) and let project = editor.outline.createItem(‘New Project:’ \r \t ‘-New Task’)

Thank you again!