$InputObject.ShowMessageBox
Description
Section titled “Description”Shows a MessageBox to the logged on user. If a MessageBox is already shown, it will be replaced.
The MessageBox is displayed by CapaInstaller InfoCenter as a notification in the lower-right corner of the user’s screen. $InputObject only exists when the agent runs the PowerPack, so you can’t use this function when you run the script by hand.
If InfoCenter isn’t running in a user session, the agent waits up to 5 minutes for it to start. If InfoCenter still isn’t available, for example because no user is logged on, nothing is shown and the function returns the default button.
Syntax
Section titled “Syntax”[string] $InputObject.ShowMessageBox(title, message, buttons, defaultButton, icon, timeoutSeconds, async)
Considerations for Æ Ø Å
Section titled “Considerations for Æ Ø Å”There are no specific considerations for the use of special characters (unlike Sys_BreakThruMsgBox)
Parameters
Section titled “Parameters”title (String)
Section titled “title (String)”Title of the messagebox. Titles longer than 75 characters are shortened.
message (String)
Section titled “message (String)”Text in the messagebox
buttons (String)
Section titled “buttons (String)”Specifies button-type. Valid values: ‘OK’, ‘YESNO’, ‘YESNOCANCEL’, ‘ABORTRETRYIGNORE’, ‘OKCANCEL’ and ‘RETRYCANCEL’
defaultButton (String)
Section titled “defaultButton (String)”Specifies the default button in messagebox. Valid values: ‘ONE’, ‘TWO’ or ‘THREE’. ‘ONE’ is the first button named in buttons — for example, Yes in ‘YESNOCANCEL’.
icon (String)
Section titled “icon (String)”Icon-style of the messagebox. Valid values: ‘STOP’, ‘QUESTION’, ‘EXCLAMATION’, ‘INFORMATION’. InfoCenter currently shows the same icon for every style.
timeoutSeconds (Integer)
Section titled “timeoutSeconds (Integer)”Number of seconds the messagebox is shown. If the user has not clicked any of the buttons within the timeout, the messagebox closes and the default button is returned
async (Boolean)
Section titled “async (Boolean)”Specifies if the messagebox displays asynchronously($true) or waits for the user to respond($false)
Return value
Section titled “Return value”Result will be returned from the function. Valid answers are: ‘OK’, ‘YES’, ‘NO’, ‘ABORT’, ‘RETRY’, ‘CANCEL’ and ‘IGNORE’
When async is $true, the function returns right away with an empty string. To remove an asynchronous MessageBox before it times out, call $InputObject.CloseMessageBox.
Example:
Section titled “Example:” $cs.Job_WriteLog("Showing MessageBox") $messageBoxResponse = $InputObject.ShowMessageBox("MessageBox title", "This is a test messageBox from a PowerPack (æøå). Please click one of the three buttons below", "YESNOCANCEL", "TWO", "QUESTION", 180, $false) $cs.Job_WriteLog("response: $messageBoxResponse")