TutorialGetting Started with MacrosMacro EditorUser InterfaceMenus and ToolbarEditing Macro StatementsExpression EditorMacro DebuggingHow ToUsing variablesFinding and modifying objectsCreating new page contentAsking for user inputStoring persistent dataSorting objectsSample MacrosConceptsExpressionsObjectsPropertiesVariablesData TypesArraysFunctionsLiteralsOperatorsComments |
Last updated on: February 06, 2021
Also available as a single HTML file Onetastic Macro Documentation > Concepts > Expressions ExpressionsMacro statements mostly evaluate expression to read or modify data. Expressions can be used to assign variables, access object properties, call functions and do arithmetic, logical or comparison operations. They can also provide literal values. // Literal values: strings, numeric values and booleans
"String Literal"
1234
3.5
true
// Variables
$name
$format
// Assignment
$i = 0
$i += 1
$x = true
$x &&= false
$s = "text"
$s &= " more text"
// Arithmetic
(3 - 5) * 2
$x || $y
// String concatenation
("text" & $str) & " more text"
// Comparison
7 > 4
"text" != $x
// Unary sign and logical not
+3
-5
!$a
// Ternary operator ?:
($x > 3) ? "yes" : "no"
// Function Calls
String_Split($str, ";")
DialogBox_Create("message")
// Property access
GetCurrentPage().name
$Section.color
// Array index
$names[0]
$multi_dim_arr[0][1][2]
$Section.pages[1]
A more complex expression can combine all of these simpler expressions: "Last page in the section has " & ((String_Length($Section.pages[(Array_Length($Section.pages) - 1)].name) > 0) ? "a name" : "no name")
|
ReferenceStatementsForEachIfElseWhileExpressionCommentBreakContinueReturnHierarchy ObjectsNotebookRootNotebookSectionGroupSectionPagePage ObjectsTitleOutlineTableColumnRowCellParagraphTextImageEmbeddedFileTagOther ObjectsDialogBoxFunctionsArray FunctionsColor FunctionsData Store FunctionsDate/Time FunctionsDialog Box FunctionsMacro Execution FunctionsObject FunctionsString Functions |