nikivi
October 2, 2018, 1:12pm
1
I want to create a KM macro that will jump to a certain project and focus in on it. Basically what the Go to Project..
search does but without triggering the palette.
So I can run it from my browser and it switches to TaskPaper with the specified project in focus.
Is this possible to do?
You can do this with AppleScript by setting focusedItem
on the OutlineEditor .
Jim
October 2, 2018, 10:35pm
3
@jessegrosjean — can you show an example AppleScript to focus Inbox?
This script focuses top level “Inbox” project. If such a project doesn’t yet exist it creates it, and then focuses it.
function TaskPaperContext(editor, options) {
let outline = editor.outline
let inbox = outline.evaluateItemPath('/project Inbox')[0]
if (inbox == null) {
inbox = outline.createItem('Inbox:')
outline.root.insertChildrenBefore([inbox], outline.root.firstChild)
}
editor.focusedItem = inbox
}
Application('TaskPaper').documents[0].evaluate({
script: TaskPaperContext.toString()
});
2 Likes
Jim
October 2, 2018, 11:45pm
5
Thanks @jessegrosjean !
Edit: I set this up for a few projects and have been using it this afternoon—I love it! Kudos!