Microsoft® Windows® Script Host Popup Method |
WSH Reference Version 1 |
Displays a pop-up message box window that contains the message contained in strText.
intButton = object.Popup(strText, [natSecondsToWait], [strTitle], [natType])
Part Description object WshShell object. strText The text to appear in the pop-up window. natSecondsToWait Optional. The number of seconds to wait before closing the pop-up window. strTitle Optional. The text to appear in the title of the pop-up window. natType Optional. The type of buttons and icons to display in the pop-up window.
The window title of this message box is specified by strTitle. If strTitle is omitted, the window title is "Windows Script Host."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 Microsoft Win32® application programming interface MessageBox function. The following tables show the values and their meanings. You can combine values in these 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 previous two tables do not cover all values for natType. For a complete list, see the Microsoft 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
The following example generates a simple pop-up window:Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Popup "Where do you want to go today?"