Prepend Draft ¶’s to Outline as Rows
Drafts → OmniOutliner
1Writer → OmniOutliner
Synopsis: The individual paragraphs of the Drafts document are prepended to the current OmniOutliner outline as rows.

Here’s a variation on the previous appending script that prepends draft paragraphs, in order, to the beginning of an OmniOutliner outline, as rows.

stringsArray = XXXXX stringsArray.reverse().forEach(function(string){ if (rootItem.children.length === 0){ rootItem.addChild(null,function(item){ item.topic = string }) } else { insertPosition = rootItem.children[0].before rootItem.addChild(insertPosition,function(item){ item.topic = string }) } })

And here is the Omni Automation script placed within a function in the JavaScript action template:

(() => { function prependParagraphsToOutline(stringsArray){ stringsArray.reverse().forEach(function(string){ if (rootItem.children.length === 0){ rootItem.addChild(null,function(item){ item.topic = string }) } else { insertPosition = rootItem.children[0].before rootItem.addChild(insertPosition,function(item){ item.topic = string }) } }) }; const stringsArray = editor.getText().split('\n'); app.openURL( 'omnioutliner://localhost/omnijs-run?script=' + encodeURIComponent( '(' + prependParagraphsToOutline + ')' + '(' + JSON.stringify(stringsArray) + ')' ) ); })();
drafts-prepend-action

And the script action in use:

UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER