Created
January 9, 2018 16:24
-
-
Save colinf/6d182493da6dfb07460235a65e8c5948 to your computer and use it in GitHub Desktop.
Read the top level rows of the outline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const runJxa = require('run-jxa') | |
let resultPromise = getRows() | |
resultPromise.then(rows => { | |
console.log(rows) | |
}) | |
async function getRows () { | |
let rows = await runJxa(readChildren) | |
return rows | |
} | |
function readChildren () { | |
let oo = Application('OmniOutliner') | |
let doc = oo.documents[0] | |
let childRows = doc.children | |
let idList = childRows.id() | |
let nameList = childRows.name() | |
let hasChildrenList = childRows.hasSubtopics() | |
return idList.map((id, i) => { | |
return {id, name: nameList[i], hasChildren: hasChildrenList[i]} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment