Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macro Statements

Expression Editor

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: March 19, 2023
Also available as a single HTML file

Onetastic Macro Documentation > Macro Editor > Macro Debugging

Macro Debugging

Macro Editor allows running macros step by step under the debugger via the
Debug > Start Debugging (F10) command or the Debug > Run under Debugger (F5) command. This will switch the editor into the debugger mode and will display the next statement with a  yellow background, activate the Object Browser with local variables:

Macro Debugger

Once in the debugger mode, you can step through the macro and see the local variables in the Object Browser. Following menu and toolbar will appear in debug mode:

Macro Editor Debug Toolbar

Breakpoints

You can set a breakpoint on a statement using Toggle Breakpoint button or the F9 key. This works both in the editor and in the debugger. The statements with a breakpoint will show with a  maroon background  and the debugger will stop when it hits one of the breakpoints.

Object Browser

Macro Debugger automatically displays the Object Browser on the right. Object Browser allows browsing OneNote hierarchy under Current Page, Section, Section Group, Notebook and under all notebooks. This way you can look into how the objects and their properties are stored in OneNote. This is also useful while editing a macro and can be activated using View > Object Browser (Ctrl+J). Object Browser displays local variables currently in use in the macro under Locals section, allowing you to see the types and values of them.

Demonstration

Watch the short video here to learn more about how to use these tools.

Reference

Statements

For

ForEach

If

Else If

Else

Switch

Case

Default

While

Expression

Comment

Break

Continue

Return

Hierarchy Objects

NotebookRoot

Notebook

SectionGroup

Section

Page

Page Objects

Title

Outline

Table

Column

Row

Cell

Paragraph

Text

Image

EmbeddedFile

Tag

Other Objects

DialogBox

MacroMenu

Window

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

String Functions

Window Functions