Why is there no 'Create subtask' hotkey?


#1

I think it’s super important to have it. I am forced to do this now.

02

But it has a visual delay of new task being created and then tab triggering. I want it to be a builtin feature.


TaskPaper Extensions Wiki
#2

The problem is that there are three types of items you might want to be creating Project/Task/Note. There is a shortcut for inserting each of those types as siblings to the current item.

If I wanted to create a variant that allowed inserting those items as children of the current item it would mean three new shortcuts. I decided that better then adding three new shortcuts/menu items/etc was to just have people press Tab after inserting one of those items if desired. It’s a little slower, but I want to avoid an explosion of commands and shortcuts.

You could implement as an AppleScript instead and I think that would solve the delay problem.


#3

Can you link to how one can make such an AppleScript script. I am not familiar with AppleScript unfortunately. :disappointed:


#4

Test before extensive use:

tell application "System Events"
	key code 36 using {command down}
	key code 48
end tell

As a Keyboard Maestro macro:

TP3—New Subtask.kmmacros.zip (8.3 KB)


#5

Thats what I am using now. But simulating keystrokes for something that I am using so so often seems unfortunate. TaskPaper ought to support this feature.


#6

Here’s a script that creates a task, inserts it as first child of current item, expands current item, and moves selection to the new child item.

function TaskPaperContext(editor, options) {
	let current = editor.selection.startItem
	if (current) {
		child = editor.outline.createItem('- ')
		current.insertChildrenBefore(child, current.firstChild)
		editor.setExpanded(current)
		editor.moveSelectionToItems(child, 2)
	}
}

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