Onetastic Macro Documentation >
>
>
SaveChanges SaveChanges
Saves any changes made by this macro to OneNote. After changes are saved, all objects within any modified pages are invalidated. That is, if there are variables that are holding objects within such a page (e.g. Outlines, Paragraphs, Text objects etc.) they will be invalid and should not be used again. To get to those objects again, access them through a Page object. Objects within unmodified pages are unaffected.
Macros normally save any changes they made to OneNote at the end of macro execution, except if the execution is terminated by a call to ExitMacro(false). Therefore, it is typically not necessary to use this function. However, there are some cases where you may want to save changes before macro execution ends. For example this function can be useful to obtain certain properties that will only be available after saving changes or to provide incremental updates to the user.
Syntax
void SaveChanges()
Parameters
This function has no parameters
Examples
$page = GetCurrentPage()
$outline = $page.outlines[0]
$paragraph = InsertObject($outline, "Paragraph", 0)
$text = InsertObject($paragraph, "Text", -1)
$text.value = "bold text"
$text.bold = true
$id = $paragraph.objectId
SaveChanges()
$outline = $page.outlines[0]
$paragraph = $outline.paragraphs[0]
$id = $paragraph.objectId
|