06-04-2013, 02:45 PM
Do not use the For Loop. Instead use the below code per the instructions i have written below,
How to use:
1. Save the above code as dialoghandler.vbs on your c:\ drive.
2. Be sure to modify the code to replace the window title or name.
3. Replace the appropriate keystrokes you need to send for the dialog. [ for eg :you may need to press "Enter" which inturn actually clicks on "OK" or "cancel" button.
4. Just before the line on QTP where the code executes and freezes QTP, enter this code,
SystemUtil.Run "C:\Windows\System32\Wscript.exe", "C:\dialoghandler.vbs"
Code:
Set fso = CreateObject("WScript.Shell")
While fso.AppActivate("Your Window Name") = FALSE
wscript.sleep 1000
Wend
fso.SendKeys "a", True
fso.SendKeys "N", True
wscript.sleep 7000
While fso.AppActivate ("Your Window Name") = FALSE
wscript.sleep 1000
Wend
fso.SendKeys "N", True
How to use:
1. Save the above code as dialoghandler.vbs on your c:\ drive.
2. Be sure to modify the code to replace the window title or name.
3. Replace the appropriate keystrokes you need to send for the dialog. [ for eg :you may need to press "Enter" which inturn actually clicks on "OK" or "cancel" button.
4. Just before the line on QTP where the code executes and freezes QTP, enter this code,
SystemUtil.Run "C:\Windows\System32\Wscript.exe", "C:\dialoghandler.vbs"
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.