Message Box
Message Box
Section titled “Message Box”Type: message-box · Package: UI Activities v1.0.4 · Output: string
Shows a Windows dialog box with a message and some buttons, and returns the button the user clicked. It is used to inform (a notice) or to ask for confirmation (“Do you want to continue?”).
How it works
Section titled “How it works”It shows message with the given buttons and icon, and waits with no time limit. It returns the name of the button clicked, which you can evaluate with an If, and logs Dialog closed with '…'.
- Windows labels the buttons in the computer’s language, but the returned value is always the English name from the table below.
buttonsandiconare picked from a list (they are not expressions) and are case-insensitive; an unknown value uses the default.- It needs an interactive Windows desktop: it does not work when the Agent runs as a Windows service (Session 0).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
message | string | — | The message to show. Fixed text in quotes or an expression. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | "Zoan Automation" | Window title. |
buttons | string | "OK" | Buttons to show: OK, OKCancel, YesNo, YesNoCancel, RetryCancel, AbortRetryIgnore. |
icon | string | "Information" | Icon: None, Information, Question, Warning, Error. |
Output
Section titled “Output”| Type | Description |
|---|---|
string | The button clicked: OK, Cancel, Yes, No, Retry, Abort or Ignore. |
What each combination can return:
buttons | Possible values |
|---|---|
OK | OK |
OKCancel | OK, Cancel |
YesNo | Yes, No |
YesNoCancel | Yes, No, Cancel |
RetryCancel | Retry, Cancel |
AbortRetryIgnore | Abort, Retry, Ignore |
Closing the window with the X or Esc, when Windows allows it, is the same as Cancel (or OK if it is the only button).
Example
Section titled “Example”Ask for confirmation before an action:
Message Box message = "Process " + total + " records?" buttons = YesNo icon = Question → output: answerIf condition = answer == "Yes" ├─ then: │ ... process ... └─ else: Log level = warning message = "Process cancelled by the user"Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Could not show the message box. UI activities (message-box, input-dialog) require an interactive desktop and do not work when the Agent runs as a Windows service (Session 0). … | There is no desktop to show the window on. Run the Agent in an interactive Windows session, or use Log to report without a dialog. |
| The condition is never met | You compared against the button’s label in another language ("Sí"). Compare against the returned value: "Yes", "No", "OK"… |
Related activities
Section titled “Related activities”- Input Dialog — ask for a text.
- Log — record information without a dialog (suitable for unattended runs).