$InputObject.CloseMessageBox
Description
Closes a MessageBox That was created as async, and is not needed any longer.
If you have called ShowMessageBox with async = $true and have reached a point in the installation where the MessageBox is no longer current, you can either show a new MessageBox with new information, which will close the already shown MessageBox, or you can simply close the initial MessageBox with CloseMessageBox()
It does not matter if the MessageBox, you are trying to close;
still exists, waiting for the user to click it,
the user has already clicked it,
has closed by itself, because it reached the timeout, it was created with.
Syntax
void $InputObject.CloseMessageBox()
Parameters
None
Return value
None
Example:
PowerShell
$cs.Job_WriteLog("Messagebox:","Showing MessageBox")
$messageBoxResponse = $InputObject.ShowMessageBox("Do not turn off", "Please do not turn off your computer. Hardware drivers are being installed", "OK", "ONE", "Info", 300, $true)
$cs.Job_WriteLog("Install:","response: $messageBoxResponse")
# for testing, wait 5 seconds
Start-Sleep -Seconds 5
$cs.Job_WriteLog("MessageBox:","Closing")
$InputObject.CloseMessageBox()
$cs.Job_WriteLog("MessageBox:","Closed")Related functions
https://capasystems.atlassian.net/wiki/spaces/CI67DOC/pages/20342577022 https://capasystems.atlassian.net/wiki/spaces/CI67DOC/pages/20342580404