Thursday, September 25, 2008

How the Message Boxes Close Automatically

The following script shows a message box that disappears after the specified timeout (in seconds). The script execution then continues.

If TimeOut is 0, it behaves just like a normal message box. If TimeOut is greater than 0, the dialog box disappears after the specified number of seconds.

Set wShellObj=createobject("WScript.shell")
wShellObj.popup "Hello Uday, How are you",10,"This is sample" ' Displays like this:



The message box automatically closes after 10 sec.s

Even we can handle the error messages from the error handling mechanism like this:
Set fileSysObj=createobject("Scripting.filesystemobject")
On Error resume next
fileSysObj.opentextfile("c:\uday.txt")
str=Err.description
wShellObj.popup str,3,"This is for file not found"

No comments: