Skip to content

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?”).

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.
  • buttons and icon are 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).
ParameterTypeDefaultDescription
messagestring—The message to show. Fixed text in quotes or an expression.
ParameterTypeDefaultDescription
titlestring"Zoan Automation"Window title.
buttonsstring"OK"Buttons to show: OK, OKCancel, YesNo, YesNoCancel, RetryCancel, AbortRetryIgnore.
iconstring"Information"Icon: None, Information, Question, Warning, Error.
TypeDescription
stringThe button clicked: OK, Cancel, Yes, No, Retry, Abort or Ignore.

What each combination can return:

buttonsPossible values
OKOK
OKCancelOK, Cancel
YesNoYes, No
YesNoCancelYes, No, Cancel
RetryCancelRetry, Cancel
AbortRetryIgnoreAbort, 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).

Ask for confirmation before an action:

Message Box message = "Process " + total + " records?" buttons = YesNo icon = Question → output: answer
If condition = answer == "Yes"
├─ then:
│ ... process ...
└─ else:
Log level = warning message = "Process cancelled by the user"
MessageCause 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 metYou compared against the button’s label in another language ("Sí"). Compare against the returned value: "Yes", "No", "OK"…
  • Input Dialog — ask for a text.
  • Log — record information without a dialog (suitable for unattended runs).