I often take notes in OO, but then copy them into other apps, such as Apple Notes or DevonThink.
But if my OO notes included indents (different levels), then when I paste these notes into the other apps they will have indents also. Which I’d rather they didn’t have in the new apps.
Exporting the OO notes to .rtf or even .txt retains the indents, so that doesn’t work for me.
(I know I can simply not use indents in OO, but often it’s convenient.)
The only export that I’ve been able to find that does not retain the indents is Microsoft Word (outline), the name of which would make one think it would retain the outline structure, but happily, it doesn’t.
Okay, so exporting to Word gives me the non-indented text I want. But … my OO outlines have a pale yellow background, because I find it pleasing (and because it reminds me of Ecco Pro). And when I export to Word it retains the yellow background behind the letters, which I’d rather it didn’t.
Alright, I figure no problem, I’ll just change the background color in Pages. Which works, but it’s another kludge.
So my question is this: is there some easy way I can take the text from an OO outline that has indents and a background color … and get it into another app without the indents and without the b.g. color?
This script only captures topic text. Execute it in Script Editor and set language tab to JavaScript:
(() => {
'use strict';
// OMNI JS CODE ---------------------------------------
const omniJSContext = () => {
// main :: IO ()
const main = () => {
const
items = document.outline.rootItem.children;
return either(x => x)(unlines)(
items.length === 0 ? (
Left("No selection items in OO GUI")
) : Right(
items.flatMap(
foldTreeOO(x => xs => [x.topic, ...concat(xs)])
)
)
)
};
// FUNCTIONS --
// foldTreeOO :: (OOItem -> [b] -> b) -> OOItem -> b
const foldTreeOO = f => {
const go = x => f(x)(
x.children.map(go)
);
return go
};
// GENERICS ----------------------------------------------------------------
// https://github.com/RobTrew/prelude-jxa
// JS Prelude --------------------------------------------------
// Left :: a -> Either a b
const Left = x => ({
type: "Either",
Left: x
});
// Right :: b -> Either a b
const Right = x => ({
type: "Either",
Right: x
});
// concat :: [[a]] -> [a]
const concat = xs =>
xs.flat(1);
// either :: (a -> c) -> (b -> c) -> Either a b -> c
const either = fl =>
// Application of the function fl to the
// contents of any Left value in e, or
// the application of fr to its Right value.
fr => e => "Left" in e ? (
fl(e.Left)
) : fr(e.Right);
// repeat :: a -> Generator [a]
const repeat = function* (x) {
while (true) {
yield x;
}
};
// unlines :: [String] -> String
const unlines = xs =>
// A single string formed by the intercalation
// of a list of strings with the newline character.
xs.join("\n");
return main()
};
// OmniJS Context Evaluation ------------------------------------------------
return 0 < Application('OmniOutliner').documents.length ? (
Application('OmniOutliner').evaluateJavascript(
`(${omniJSContext})()`
)
) : 'No documents open in OmniOutliner.'
})();
I am able to do it by exporting to Word - which gets rid of the indents - then changing the background color - which gets rid of the yellow - and then copying and pasting into Notes. I was just hoping there was a faster way.
Again, many thanks for trying. I really appreciate it.