The functions vtcapp.msgbox() and vtcapp.inputbox() and their parameters
In Scripts in Vertec, message and input boxes can be shown.
It is important to note the following:
Make sure that there is an interface where the user can also reply to the dialog. In Event Scripts, Scheduled tasks or via Web Service, for example, this is not the case. You can check this with the OCL operator .hasGUI in the script:
if vtcapp.evalocl("Session.allInstances->first.hasGUI"): vtcapp.msgbox("This is my text")
Dialogs must not be displayed within the SystemContext, i.e. with Extended user rights. These are system-wide, and as long as such a dialog is not closed, the extended user rights apply throughout Vertec.
vtcapp.msgbox(text[, buttons][, title])
The text to be shown.
If only the text is given, the message box shows the title Information and an OK button:
vtcapp.msgbox("This is my text")

For breaking lines, \n can be used:
vtcapp.msgbox("Here comes \nthe line break")

Specifies the combination of buttons (OK, Cancel, etc.) and symbols (red X, yellow exclamation mark, etc.) by number.
vtcapp.msgbox("This is my text", 1)

| Value | Description |
|---|---|
| 0 | OK button |
| 1 | OK and Cancel buttons |
| 3 | Yes, No, and Cancel buttons |
| 4 | Yes and No buttons |
| 16 | Critical message: red X symbol and an OK button |
| 48 | Warning: yellow exclamation mark symbol and an OK button |
| 64 | Information: Blue i symbol and an OK button |
The title of the message box.
vtcapp.msgbox("This is my text", 1, "Vertec")

If a title is specified, a button must also be specified.
The message box has the following return values:
| Value | Clicked button |
|---|---|
| 1 | OK |
| 2 | Cancel |
| 6 | Yes |
| 7 | No |
vtcapp.inputbox(title, text[, default])
The title of the input box. If you don't want the input box to have a title, specify an empty string.
The text to be shown:
vtcapp.inputbox("Vertec", "What's your name?")

If the text is multi-line, the individual lines can be broken by \n.
If you want to show text as the default answer in the text box, you can specify it as third parameter.
vtcapp.inputbox("Vertec", "What's your name?", "Enter your name here")

If the user clicks OK (or presses Enter), the content of the text box is returned.
If the user clicks Cancel, an empty string is returned. Note that you cannot distinguish whether the user clicked cancel or returned an empty text.