Scripting with multiple windows


#1

Currently I use the following code pattern to expand KeyboardMaestro macros:

function TaskPaperContextScript(editor, options) {
    var sel = editor.selection;
    ...
}
Application("TaskPaper").documents[0].evaluate({
    script: TaskPaperContextScript.toString()
});

That works like a charm for single document window. How should I modify the approach for working with two windows opened for single document?

Thank you an advance.


#2

Sorry I don’t have a proper API for that right now… right now it will just select the frontmost window for the given document. What specifically are you trying to do?


#3

It looks like it selects not the frontmost window but the first opened one. I just type a macro into the second (frontmost) window, but the editor.selection evaluates from the context of first (background) window.


#4

Opps you are correct … I’m fixing this now for the next preview release. Also I’m adding a class method OutlineEditor.getOutlineEditorsForOutline(outline) which will return all outlineEditors associated with the provided outline.


#5

Great, now it works correctly, thank you!