Create new outline from selected section?

What I’m looking for is a javascript that will take a selected section/subsection of an existing outline and move that section to a new outline doc containing just that section. I’d like the new outline to use the same styles used in the original outline. Does such a script exist? If not, pointers to OO automation tutorials are welcome

Hint:

To copy a selected row (and its descendants) into a new outline, you can paste this code into the Console.

(() => {
    const 
        editor = document.editors[0];

	editor.copyNodes(editor.selectedNodes, Pasteboard.general)
    
    Document.makeNewAndShow(function(doc){
        doc.editors[0].paste(Pasteboard.general)	
    })
})();

As far as preserving styles, I haven’t tested. You can look at OmniAutomation API, OmniAutomation.com or search OmniJS scripts here.

2 Likes

Got it @unlocked2412, Thanks for answering.