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 > Functions > Dialog Box Functions > ShowTaskDialog

ShowTaskDialog

Shows a task dialog to the user with a number of command buttons to choose from.

Syntax

Integer ShowTaskDialog(
	String title, 
	String message, 
	Array<String> buttons)

Parameters

String title
A title for the task dialog.
String message
A message for the task dialog that will show below the title.
Array<String> buttons
An array of button labels.

Remarks

A task dialog contains a title, a message and a set of command buttons. It may look like this:

Example Task Dialog

User can click one of the command buttons or close the dialog. If user clicks one of the buttons, the dialog will close and this function will return the index of the button in the given button array (0 for the first button, 1 for the second button etc). If user closes the dialog using the X button on the top right corner, then macro execution will stop.

Examples

$message = "You can save the currently selected text as a snippet to be used for later, or you can insert one of the previously saved snippets to the current page." $buttons = Array("Insert previously saved text snippet", "Save selected text as a snippet", "Manage text snippets") $selected = ShowTaskDialog("Choose an option", $message, $buttons) ExpandSwitch ($selected) ExpandCase 0: // User selected first option Break 1 ExpandCase 1: // User selected second option Break 1 ExpandCase 2: // User selected third option Break 1

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