Macro Editor Updates and new Macros for Footnotes
September 03, 2022
Whole Macro Search in Macro Editor
Macro Editor has a Search and Replace functionality
to easily edit macros. This used to support searching within the current function or scoping the search down to the selection. With a new update, ability to search and replace within all function of the macro is now possible. To use this, choose the Whole Macro option under search scope.
With this addition, it will be a breeze to edit function or variable names within multiple functions or do some more advanced editing. When searching and replacing under Whole Macro scope, search results will display number of hits within the whole macro, and as you find the next or previous hits, it will go through any other functions that have the search hits. A replace all command will replace all hits in the whole macro.
Along with this feature, the function signatures for user defined functions are now visible in the editor above the statements for the current function, and you can now also search in function signatures or make replacements in them.
Fast Editing Options for Macro Editor
Another update to the Macro Editor is an option for fast editing. This option is available under Tools
This option allows faster editing of macros by automatically opening the Expression Editor whenever you insert a statement that contains an expression. This way you will be directly editing inserted statements without having to click on the expressions. Typically Break and Continue statements don't require further editing, so if you don't want this for Break and Continue statements, check the second option.
These new options are available to Dev License users.
New Function: SaveChanges
A new function SaveChanges
is added to Macro Language to allow saving changes to OneNote prior to the end of a macro. 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. See the the documentation for this new function
for an example and additional considerations on how to use this function correctly.
As part of this update, two new macros are added to Macroland: Add Footnote and Remove Footnote. With these macros, you can easily add footnotes to your OneNote pages, complete with links to go from content to the footnote and back, and quickly remove them when you don't need them anymore. See below video for a demonstration: