Posts

Showing posts with the label WScript

Read Value from Registory / QTP / WScript

Here an example to get get the location where QTP is installed REM Create shell script object   Set WshShell = CreateObject(“WScript.Shell”) REM in variable store the registry key path   sKey =”HKLM\SOFTWARE\Mercury Interactive\QuickTest Professional\Configuration_UI\Packages\WebFormsPackage\Settings\ConfigurationFile” REM here using the shell object we can read the registry key value sQTPpath= WshShell.RegRead(sKey) msgbox sQTPpath set WshShell = nothing

Execute a DOS command in QTP / CMD with QTP

REM using "Wscript.Shell" object we can work on command prompt in qtp. REM create one instance for "wscript.Shell" set oShell=CreateObject("Wscript.Shell") REM using run method we can invoke application REM /k this will display command prompt.we can also use /c but we can not see command prompt.It will disappear after execution. oShell.Run "cmd /k dir" REM for wait in ms WScript.sleep 3000 REM if we want use multiple commands we can use "&"(amp) symbol oShell.run "cmd /k dir & md qtp" REM we can use send keys method here {ENTER} will press enter button oShell.SendKeys "cd{ENTER}" REM if we want use multiple commands we can use "&"(amp) symbol oShell.Sendkeys "cd c:\{ENTER} md qtp ~" REM ~ for enter key {ENTER} = ~ oShell.Sendkeys "cd d: ~" set oShell=Nothing

Use Send Key Method QTP VB

Hi All, Some time we requre keyboard event in Automation so we can use Send key method rem ********************************************** rem create shell object set WshShell = CreateObject(“WScript.Shell”) SystemUtil.Run “C:\Program Files\HP\QuickTest xcxProfessional\samples\flight\app\flight4a.exe”,”C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe”,”",”" rem first click in the text box then use send key method Dialog(“text:=Login”).WinEdit(“attached text:=Agent Name:”).Click rem enter rajiv in agent name text box WshShell.SendKeys “rajiv” rem click Password Edit box Dialog(“text:=Login”).WinEdit(“attached text:=Password:”).Click rem enter check in Password text box WshShell.SendKeys “check “ Dialog(“text:=Login”).WinButton(“text:=OK”).Click rem press escape using send key method WshShell.SendKeys “{ESC}” WshShell.SendKeys “{ESC}” rem ********************************************************** Use the SendKeys method to send keyst...