Easy way to set a timeout in a VBS message box (msgbox)

Posted by Admin Friday, October 23, 2009 2:16:29 AM Categories: _Tous les articles VBS / Scripting
Rate this Content 0 Votes

DESCRIPTION
 A very easy way to add a timeout in a message box (msgbox) in a VBS (WSH Windows Scripting Host) file.


Option Explicit
Dim oShell
Dim iResult

' Create Shell object
Set oShell = CreateObject("Wscript.Shell")

'Open message box Yes/No and test response
iResult = oShell.Popup("This message box will close after 2 seconds.", 2, "Title box", 4)

'Test the return of messagebox
If iResult = 6 Then
 Wscript.Echo "YES"
ElseIf iResult = 7 Then
 Wscript.Echo "NO"
Else
 Wscript.Echo "NO RESPONSE"
End If
 



MSDN : http://msdn.microsoft.com/en-us/library/x83z1d9f(VS.85).aspx

Simple-Tech.info
Comments are closed on this post.
Site Map | Printable View | © 2008 - 2012 Simple-Tech.info | Powered by mojoPortal | HTML 5 | CSS | Design by mitchinson