|
Onetastic Macro Documentation >
>
Objects
Objects
Objects in macros represent OneNote's notebook/section/page hierarchy as well as the contents of a OneNote page.
Querying Objects
Macros can query objects using QueryObjects function and modify their properties:
Copied!
foreach ($Text in QueryObjects("Text", GetCurrentPage()))
If ($Text.highlightColor == "yellow")
$Text.highlightColor = "green"
Macros can also create new pages and insert content on a page:
Copied!
$Page = InsertObject(GetCurrentNotebook().sections[0], "Page", -1)
$Page = GetCurrentPage()
$Outline = InsertObject($Page, "Outline", -1)
$Paragraph = InsertObject($Outline, "Paragraph", 0)
$Paragraph.text = "Below is a table"
$Table = InsertObject($Outline, "Table", -1)
$Row = InsertObject($Table, "Row", -1)
$Cell = InsertObject($Row, "Cell", -1)
$Paragraph = InsertObject($Cell, "Paragraph", -1)
$Text = InsertObject($Paragraph, "Text", -1)
$Text.value = "First"
$Text.bold = true
InsertObject($Paragraph, "Text", -1).value = " cell"
InsertObject($Row, "Cell", -1).text = "A second cell"
Following is the list of objects macros recognize with the hierarchical structure:
Hierarchy Objects
* indicates, there can be multiple objects of this type
Page Objects
* indicates, there can be multiple objects of this type
Each Paragraph has a content which can be a group of Text, or an Image, or an EmbeddedFile, or a Table
|