Posts

Showing posts from March, 2010

QTP Scripts to make life easy..

Normalizing Strings The NormalizeString function receives a string and returns the equivalent string in a regular expression. Function NormalizeString(OrgStr) Dim TempStr TempStr = Replace(OrgStr, "\", "\\") TempStr = Replace(TempStr, "*", "\*") TempStr = Replace(TempStr, "+", "\+") TempStr = Replace(TempStr, ".", "\.") NormalizeString = Replace(TempStr, "?", "\?") End function msgbox NormalizeString ("a+b*c.d?e") 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 TimeO...