WshShell.Popup

The Popup method displays a popup message box window that contains the message contained in strText. The window title of this message box is specified by strTitle. If strTitle is omitted, the window title is Windows Scripting Host.

Syntax

WshShell.Popup(strText, [natSecondsToWait], [strTitle], [natType]) = intButton
 

Remarks

If natSecondsToWait is supplied and its value is greater than zero, the message box window will be closed after natSecondsToWait seconds.

The meaning of natType is the same as in the Win32?MessageBox function. The following table shows the value and its meaning in natType. You can combine values in the following tables.

Button Types

Value Description
0 Show [OK] button
1 Show [OK] and [Cancel] buttons
2 Show [Abort], [Retry] and [Ignore] buttons
3 Show [Yes], [No] and [Cancel] buttons
4 Show [Yes] and [No] buttons
5 Show [Retry] and [Cancel] buttons

Icon Types

Value Description
16 Show Stop Mark icon
32 Show Question Mark icon
48 Show Exclamation Mark icon
64 Show Information Mark icon

The preceding two tables do not cover all values for natType. For a complete list, see the Win32 documentation.

The return value intButton denotes the number of the button that the user clicked. If the user does not click a button before natSecondsToWait seconds, intButton is set to -1.

Value Description
1 [OK] button
2 [Cancel] button
3 [Abort] button
4 [Retry] button
5 [Ignore] button
6 [Yes] button
7 [No] button

Example

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Popup "Where do you want to go today?"
 

See Also

Wscript.Echo method