In Python scripts, 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, planned 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("Dies ist mein Text")
Dialogues must not be displayed shown 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 would apply throughout Vertec.
vtcapp.msgbox(text[, buttons][, title])
The text to show.
If only the text is specified, the message box contains the title “Information” and an OK button:
vtcapp.msgbox("Dies ist mein Text")

Long texts can be wrapped with \n:
vtcapp.msgbox("Hier kommt \nder Zeilenumbruch")

Specifies the combination of buttons (OK, Cancel, etc.) and symbols (red X, yellow exclamation mark, etc.) to be shown. This is done by a number. If nothing is specified, the message box contains an OK button.
vtcapp.msgbox("Dies ist mein Text", 1)
The most commonly used buttons / icons are:
| 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 and an OK button. |
| 48 | Warning: yellow exclamation mark and an OK button. |
| 64 | Information: Blue I and an OK button |
The title of the message box.
vtcapp.msgbox("Dies ist mein Text", 1, "Vertec")

If a title is specified, a button must also be specified.
If nothing is specified, the message box is titled “Information”.
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 a blank string.
The text to show.
vtcapp.inputbox("Vertec", "Wie lautet Ihr Name?")

If the text is multi-line, the individual rows can be separated by \n.
If you want to show text as the default answer in the field, you can specify the value as the third parameter.
vtcapp.inputbox("Vertec", "Wie lautet Ihr Name?", "Hier Ihren Namen eingeben")

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.