WSH » wshshell » Popup

Syntax:
WshShell.Popup [,intSecondsToWait] [,strTitle] [,intType]
intSecondsToWait
Receives an integer containing the number of seconds that the box will display for until dismissed. If zero or omitted, the message box stays until the user dismisses it.
strTitle
Receives a string containing the title that will appear as the title of the message box.
strMessage
Receives a string containing the message that will be displayed to the user in the message box.
intType
Receives an integer that corresponds to a particular look and behavior defined in the intType table.

The Popup method displays a pop-up message box.

The Popup method displays a pop-up message box with the message specified in strMessage for intSecondsToWait seconds before dismissing the message box. If intSecondsToWait is zero or omitted, then the message box stays until the user dismisses it. The parameter strTitle is used to specified the title of the pop-up message box (if it is omitted, the default is "Windows Script Host"). The parameter intType is used to specify the look and behavior of the pop-up message box.

The following tables show some of the values that can be used for intType.

Value Button
0 OK
1 OK, Cancel
2 Abort, Ignore, Retry
3 Yes, No, Cancel
4 Yes, No
5 Retry, Cancel
  
Value Icon
16 Critical
32 Question
48 Exclamation
64 Information

The button values and icon values can be added together for composite effect. For example intType of 4 + 32 means a message box with the 'Question' icon, and 'Yes' and 'No' buttons.

The Popup method can also return the button which the user clicked to dismiss the pop-up message box.

intReturnValue Button Clicked
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No
-1 None, message box was dismissed automatically (timeout)

Examples

Code:
Set WshShell = CreateObject("WScript.Shell")

intButton = WshShell.Popup ("Click a button to proceed.", 5, , 2 + 48)

select case intButton
  case -1
    strMessage = "You did not click any button within the 5 seconds allotted."
  case 3
    strMessage = "You clicked the Abort button."
  case 4
    strMessage = "You clicked the Retry button."
  case 5
    strMessage = "You clicked the Ignore button."
end select

WshShell.Popup strMessage, , , 64
Explanation:

This VBScript code illustrates the behavior of this method.

Language(s): VBScript