QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Sunday, May 24, 2009

QuickTest Professional script for Message Boxes That Close Automatically

SPONSORED LINKS

Using Message Boxes That Close Automatically
The function below shows a message box that disappears after the specified timeout (in seconds). The script execution then continues.

Public Sub MsgBoxTimeout (Text, Title, TimeOut)

Set WshShell = CreateObject("WScript.Shell")

WshShell.Popup Text, TimeOut, Title

End Sub

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.

SPONSORED LINKS

2 comments:

jatinder singh sodhi said...

when i used this code then it open the same message box again so please clear it why its happened.

Ranjan said...

When you are using this code.
Don't use Msgbox separately and MsgBoxTimeout separately. It should be used only once.
What ever you want in msgbox should be 'text' for MsgBoxTimeout.
E.g. MsgBoxTimeout variable name , ""(if title is blank), 2