Extract segment

Creates a new page from a selected segment, using the first line as the title


Author(s) : jeremyr
Category : Pages
Last Updated : June 19, 2016
Requirements : OneNote 2010 or above
Changelog :

June 19, 2016 (17CBB0) - jeremyr
Automatically upgraded to the new Macro Language

These versions are no longer supported:

July 17, 2014 - jeremyr
Initial version


Dan88 - 2016-10-14
Hello Omer,
yay! That did the job nicely.
I have created an account and will  share my macros, once the code works correctly as sometimes I mess up the code, it takes me time to organise things  - I am a total newbie and moved from evernote and am surprised one note is awesomely great.
Thanks for the help
Good day to all  :)
Omer Atay - 2016-10-14
Dan: I haven't tested but it looks like instead of this:
InsertObject($outline, "Paragraph", -1).text = $titleParagraph
You need this:
InsertObject($outline, "Paragraph", -1).text = $titleParagraph.text
Dan - 2016-10-14
Hi Omer,
Good day to you!
I am trying to make the Title of each page become the First paragraph in each page.
I have this so far -  but I cant work out the error.

<?xml version="1.0" encoding="utf-16"?>
<Macro name="Insert Title As Paragraph 1" category="Test Macros" description="Insert into Each Page Title as Paragraph 1 " publishDate="00-00-00T00:00:00.000Z" version="13">
  <ForEach var="page">
    <Array>QueryObjects("Page", GetCurrentSection())</Array>
    <Expression>$titleParagraph = QueryObjects("Paragraph", $page)[0]</Expression>
    <Expression>$outline = InsertObject($page, "Outline", -1)</Expression>
    <Expression>InsertObject($outline, "Paragraph", -1).text = $titleParagraph</Expression>

I think i am nearly there but have been stuck for hours :(

please advise
thank you