Macro to convert a tab delimited text into a multi-level outline

Hello,

I apologize in advance for the poor title.

There is an excellent mind mapping app called Simple Mind Pro.

Mind Maps are useful for brainstorming, but inconvenient when it comes to incorporating them into documents. Multi level outlines are really best suited for documents on certain conditions, for example that items can be easily moved up and down in the list, which is possible in Pages and MS Word, for example.

I am able to convert the mind map into a 'multi level' list where the indents are represented by tabs as per below in Pages. In the Pages list the blue arrows represent tabs.

Is there any way to create a macro convert the tabbed list into a conventional Pages or MS Word multi-level list?

Thanks very much for your time and help.

2018-04-19_20-21-25

Does your mindmap app export as OPML ? (most do)

If so, one route would be OPML -> Pandoc -> MS Word

https://pandoc.org/

If not, then a tabbed text to OPML (and thence MS Word thru Pandoc) macro would be feasible.

(There is also this: https://www.toketaware.com/makedoc/ )

1 Like

tab-indented text outline to OPML

See, for example:

1 Like

A draft macro here, which depends on installation of Pandoc

https://pandoc.org/installing.html

The intended use is:

  1. Select the lines of a tab-indented outline in an editor, and
  2. run this macro, responding to a save As .docx (or .doc) prompt.

To view the outline structure, choose View > Outline in MS Word.

( Note however, that Word outlines have a limited depth )

Copy a TAB-indented outline and save as MS Word.kmmacros (38.3 KB)

1 Like

Yes, it does export as OPML.

I feel bad that you spent so much time writing this macro, and I apologize profusely, because following your previous post, I looked into pandoc, and discovered that if I simply copy paste the above tab indented outline into a new MS Word document ➜ highlight all text (Cmd-A) ➜ simply click on the multi-level outline in the toolbar ➜ I get a perfect multi-level outline in which I can easily move items with the Shift-Cmd-arrows shortcut.

The docx document was an intermediate step to trying to create a multi-level outline in Scrivener 3. Are you familiar with Scrivener 3 ?

No problem at all - just handful of new lines:

    const main = () =>
        opmlFromTrees('Translation from tab indents',
            treesFromLineIndents(
                indentedLines(
                    Application('Keyboard Maestro Engine')
                    .getvariable('tabOutline')
                )
            )
        );

( It's just an illustrative Lego brick assembly of existing parts, and a useful opportunity to update one of them to work with spaces as well as tabs : - )

I'm not an active user of Scrivener (I don't think it has a scripting API ?) but that's an interesting thought – I'll have a look at the format.

Are we talking about the left hand Binder (folder+file) outline, or about bulleted / numbered outlines in a right-hand panel RTF file ?

1 Like

Just had a look – if you create an OPML file, you can import it as a Binder outline into Scrivener 3 with File > Import > Files

(With some options in the OPML section of Sharing preferences).

Automation by Keyboard Maestro might be simplest through control of menu options:

1 Like

Thank you very much CP for looking at Scrivener 3.

I tried your solution: unfortunately, the outline is imported as a multi-level folder/document hierarchy inside the Binder where all info is basically located in the title of the folders, not in the documents themselves, and is therefore difficult to view/manage/edit.

However, your post put me on the right track, and I tested the different import options: if I export the mind map as HMTL (very easy) ➜ import as HTML into scrivener ➜ I get the appearance of a multi-level list but it is not functional or editable (like an image).
If I then simply copy the contents of the imported Scrivener 3 document and paste into another document, I end up with a beautiful fully functional multi-level list.

Why this works frankly boggles my mind.

I am very grateful for your help in finding a solution to an irritating problem.

2018-04-21_19-48-42

1 Like

Why this works

Clipboard magic, I would guess. Copying a web-page generally results in a clipboard containing various representations (text, RTF etc), and at Paste time, the app can decide which representation it prefers by default.

1 Like