Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

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

Accessing the file system

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: April 20, 2025
Also available as a single HTML file

Onetastic Macro Documentation > Functions > Clipboard Functions > Clipboard_Set

Clipboard_Set

Puts information into the clipboard. The existing information in the clipboard is replaced with the given format and data.

Syntax

void Clipboard_Set(
	String|Array<String> format, 
	String|Binary|Array<String|Binary> data)

Parameters

String|Array<String> format
Format or formats describing the data being put into the clipboard. See remarks for possible values.
String|Binary|Array<String|Binary> data
One or more data to be put into the clipboard. See remarks for possible values.

Remarks

You can put a single type of information into the clipboard or put multiple different formats at the same time so that the application receiving the clipboard data upon paste can choose the best option from the different formats provided. For example you can put plain text, HTML, and image data at the same time into the clipboard.

To put single type of information, provide the format in the format parameter as a string and provide the corresponding data in the data parameter.

To put multiple types of information, provide an array of formats in the format parameter, each being a string and then provide an array of data in the data parameter, each describing the data for the corresponding format in the format parameter.

Following is the list of valid formats and corresponding data types:

Format Description Data
"plain" Plain text to be put into the clipboard A string containing the text
"html" Formatted HTML to be put into the clipboard. GetFormattedObjectContent function can be used to convert OneNote page content into HTML. A string containing the HTML
"image" Binary image data to be put into the clipboard. This can be obtained from an Image object with its data property. A binary object containing the image data

Examples

// Put some text into clipboard Clipboard_Set("plain", "Some text") // Put some HTML into clipboard. This replaces the previous plain text. Clipboard_Set("html", "Some <b>Text</b>") // Put both plain text and HTML into clipboard Clipboard_Set(Array("plain", "html"), Array("Some text", "Some <b>Text</b>")) // Put contents of an outline as HTML into clipboard $outline = GetCurrentPage().outlines[0] Clipboard_Set("html", GetFormattedObjectContent($outline, "html")) // Put contents of an image into clipboard $image = GetCurrentPage().images[0] Clipboard_Set("image", $image.data)

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Clipboard Functions

Data Store Functions

Data Type Specific Functions

Date/Time Functions

Dialog Box Functions

File System Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions