info.mailtraq.com > Management > Script Functions A-Z > MessageDlg() MessageDlg()Places a dialog box centre-screen of the machine on which Mailtraq is running. Script execution is halted until the user responds to or dismisses the dialog. This function is useful in scripts for obtaining user responses and for monitoring start and end times, the state of variables, etc.
result := MessageDlg( text [ , title [ , buttons ] ] )
- text
- Quoted text, "This is quoted text", or any expression which evaluates to a displayable string
- title
- Optional window title where "C"=Confirm, "E"=Error, "W"=Warning and "I"=Information (the default)
- buttons
- Optional dialog buttons, "OK", Yes", "No" and "Cancel" in a single string (see example). Default is "OK"
- result
- The string on the selected button face or "Cancel" if the user dismisses the dialog
// Shows dialog boxes for user response, for variable state and for time taken
i := 1;
begin_time := DateTimeToReal(FormatDateTime("dd/mm/yyyy hh:nn:ss"));
run := MessageDlg("Do you wish to see the variable example?", "C", "Yes, No, Cancel");
MessageDlg("You clicked on " ++ run ++ "", "C", "Yes");
If(run = "Yes",
While(i <= 5,
Do(
MessageDlg("This is loop iteration " ++ i),
i := i + 1
)
)
);
end_time := DateTimeToReal(FormatDateTime("dd/mm/yyyy hh:nn:ss"));
msg := "That took " ++ LJ(((end_time - begin_time) * 24 * 60 * 60), 4) ++ " seconds";
MessageDlg(msg ++ "", "W", "Cancel") |