Append Date to Title (dd.mm.yy)

Modifies the page title to append the date in DD.MM.YY format

Download

Author(s) : jkhanhl
Category : Title
Last Updated : June 05, 2017
Requirements : OneNote 2010 or above
Changelog :

June 05, 2017 (3CEC7E) - jkhanhl
Initial Version

Comments

Name
Comment
Omer Atay - 2017-07-27
DMills: This macro has an example of going through each page in the current section: https://getonetastic.com/macroland&id=D691976E51554F2CAD2D155F9CE4C992
DMills - 2017-07-26
Omer Atay:
I apologize. I'm actually a newbie when it comes to coding. However, in some cases I'm able to pick up how things work by looking at code. Can you assist me with what you're describing? Here is the XML that I have so far:

<?xml version="1.0" encoding="utf-16"?>
<Macro name="Append Date to Title (dd.mm.yy)" category="Title" description="Modifies the page title to append the date in DD.MM.YY format" version="18">
  <Expression>$Page = GetCurrentPage()</Expression>
  <Expression>$Date = QueryObjects("Page", $Page)[0].dateTime</Expression>
  <Expression>$Title = QueryObjects("Paragraph", $Page)[0].text</Expression>
  <Expression>$ShortYear = DateTime_Year($Date)</Expression>
  <Expression>$ShortYear = ($ShortYear -= 2000)</Expression>
  <Expression>QueryObjects("Paragraph", $Page)[0].text = ((((($ShortYear &amp; ".") &amp; (DateTime_Month($Date) &amp; ".")) &amp; DateTime_Day($Date)) &amp; " - ") &amp; $Title)</Expression>
</Macro>


Omer Atay - 2017-07-26
DMills: You can do something like: ForEach $page in GetCurrentSection().pages, and then do everything under that for loop using $page instead of GetCurrentPage().