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 > Object Functions > MoveObject

MoveObject

Moves of a given object from its current parent to a new parent. Moving an object is equivalent of creating a copy of the object via CopyObject and then removing the original object via RemoveObject. The passed in object parameter will point to the newly created copy after the function returns. Following types of objects can be moved: Page Outline Table Row Cell Paragraph Image EmbeddedFile Tag.

Syntax

void MoveObject(
	Object parent, 
	Object object, 
	Numeric position)

Parameters

Object parent
Parent object to move the object under. The type of the source object must be one of the types that can be inserted under the parent object. See remarks for compatible types.
Object object
Object to move. A new object of the same type will be created and all the properties and any descendant objects will be copied over. After the function returns, this parameter will point to the new object. The moved object may have a different identifier or modified date as a result.
Numeric position
The position to move the object to. The value is a 0 based index for the child collection or -1 to move at the end.

Remarks

Following types of objects can be created, copied, and moved via InsertObject, CopyObject, and MoveObject functions. See descriptions of each function for specific conditions or differences in behavior:
Parent Object Child Object Types Remarks
Notebook SectionGroup Section Sections and section groups must have unique names inside a notebook. Section groups cannot be copied or moved. Sections cannot be moved.
SectionGroup SectionGroup Section Sections and section groups must have unique names inside a section group. Section groups cannot be copied, moved, or removed. Sections cannot be moved or removed.
Section Page
Page Outline Image EmbeddedFile To create a Title object under a page, simply access its "title" property.
Outline Paragraph Table Image EmbeddedFile An outline must have at least one child object.
Paragraph Text Tag Text objects can only be inserted at the beginning or end of a paragraph. Text objects cannot be moved or removed
Table Row A table must have at least one row.
Row Cell A row must have at least one cell. Every row in a table must have the same number of cells.
Cell Paragraph Table Image EmbeddedFile A cell must have at least one child object.
Image Tag Image must be a direct child of a page to insert tags. Images inside outlines cannot have tags. Insert the tag into the image's parent paragraph instead.
EmbeddedFile Tag Embedded file must be a direct child of a page to insert tags. Embedded files inside outlines cannot have tags. Insert the tag into the embedded file's parent paragraph instead.

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