Method:  WshShell.Popup

WshShell.Popup strMessage [,intSecondsToWait] [,strTitle] [,intType]

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)


The following VBScript code illustrates the behavior of this method.

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



Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information