Micro Focus QTP (UFT) Forums
Query:Input from Keyboard - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Query:Input from Keyboard (/Thread-Query-Input-from-Keyboard)



Query:Input from Keyboard - Rachna - 04-02-2009

Hello,

while recording my script in QTp9.2 with Java application,at one point I need to press Ctrl + F10 ,so that a Pop-up screen is displayed to completed the process in my application.How do i write a function in VB which could include this CTRL + F10 portion.

Please let me know.
Regards,
Rachna


RE: Query:Input from Keyboard - manojith1984 - 04-02-2009

Hi...U can use SendKeys to handle keyboard events


RE: Query:Input from Keyboard - Tarik Sheth - 04-02-2009

This example will be helpful to you for sending keyboard inputs to the application

Code:
set WshShell = WScript.CreateObject("WScript.Shell")
         WshShell.Run "calc"
         WScript.Sleep 100
         WshShell.AppActivate "Calculator"
         WScript.Sleep 100
         WshShell.SendKeys "1{+}"
         WScript.Sleep 500
         WshShell.SendKeys "2"
         WScript.Sleep 500
         WshShell.SendKeys "~"
         WScript.Sleep 500
         WshShell.SendKeys "*3"
         WScript.Sleep 500
         WshShell.SendKeys "~"
         WScript.Sleep 2500



RE: Query:Input from Keyboard - nandu - 04-07-2009

Hi..
Before writing this statement..
First Activate calculator..

--------------------
...calculator.activate
WshShell.SendKeys ("%{F4}")
------------------


RE: Query:Input from Keyboard - Tarik Sheth - 04-07-2009

Yes, First the focus should be on Calculator and then use sendkeys to close it.


RE: Query:Input from Keyboard - Rachna - 04-07-2009

Thanks for your help.
But while executing a scenario Tongueress CTRL F10 once the "Insertcard dailog" appears so that "keyEnter Dialog" appears and we can enter the Card number ihav eused the below mentioned script ,but it doesnt work.Kindly help.
Code:
JavaWindow("Sales_BasicFlow").JavaButton("Card").Click
JavaWindow("Sales_BasicFlow").JavaDialog("Credit/Debit Card Payment").JavaButton("£50.00").Click

set WshShell = CreateObject("WScript.Shell")
JavaWindow("Sales_BasicFlow").JavaDialog("Insert Card").Activate
wait(2)
WshShell.SendKeys("^{F10}")

JavaWindow("Sales_BasicFlow").JavaDialog("Key Enter").JavaEdit("Card Number").Set "5454609899026213"[hr]
Thanks for your help.
But while executing a scenario Tongueress CTRL F10 once the "Insertcard dailog" appears so that "keyEnter Dialog" appears and we can enter the Card number ihav eused the below mentioned script ,but it doesnt work.Kindly help.
Code:
JavaWindow("Sales_BasicFlow").JavaButton("Card").Click
JavaWindow("Sales_BasicFlow").JavaDialog("Credit/Debit Card Payment").JavaButton("£50.00").Click

set WshShell = CreateObject("WScript.Shell")
JavaWindow("Sales_BasicFlow").JavaDialog("Insert Card").Activate
wait(2)
WshShell.SendKeys("^{F10}")

JavaWindow("Sales_BasicFlow").JavaDialog("Key Enter").JavaEdit("Card Number").Set "5454609899026213"[hr]
Thanks for your help.
But while executing a scenario Tongueress CTRL F10 once the "Insertcard dailog" appears so that "keyEnter Dialog" appears and we can enter the Card number ihav eused the below mentioned script ,but it doesnt work.Kindly help.
Code:
JavaWindow("Sales_BasicFlow").JavaButton("Card").Click
JavaWindow("Sales_BasicFlow").JavaDialog("Credit/Debit Card Payment").JavaButton("£50.00").Click

set WshShell = CreateObject("WScript.Shell")
JavaWindow("Sales_BasicFlow").JavaDialog("Insert Card").Activate
wait(2)
WshShell.SendKeys("^{F10}")

JavaWindow("Sales_BasicFlow").JavaDialog("Key Enter").JavaEdit("Card Number").Set "5454609899026213"



RE: Query:Input from Keyboard - Rachna - 04-08-2009

But while executing a scenario Tongueress CTRL F10 once the "Insertcard dailog" appears so that "keyEnter Dialog" appears and we can enter the Card number. i have used the below mentioned script ,but it doesnt work.Kindly help.
Code:
JavaWindow("Sales_BasicFlow").JavaButton("Card").Click
JavaWindow("Sales_BasicFlow").JavaDialog("Credit/Debit Card Payment").JavaButton("£50.00").Click

set WshShell = CreateObject("WScript.Shell")
JavaWindow("Sales_BasicFlow").JavaDialog("Insert Card").Activate
wait(2)
WshShell.SendKeys("^{F10}")

JavaWindow("Sales_BasicFlow").JavaDialog("Key Enter").JavaEdit("Card Number").Set "5454609899026213"[hr]
also tried dis:
Code:
Set WshShell = CreateObject("WScript.Shell")    WshShell.AppActivate "Sales_BasicFlow"    WshShell.Sleep 3000    WshShell.SendKeys "^{F10}"

i tried using this ,but still as in real scenario after press of Ctrl + F10 the next pop up appears of KEY entry...but after executing the script
in this statement:
WshShell.SendKeys "^{F10}"


no action is seen on the screen.

Please let me know how it can be resolved?
I am using QTP9.2 and working on Java Windows application