Micro Focus QTP (UFT) Forums
dblclick help - 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: dblclick help (/Thread-dblclick-help)



dblclick help - pjavvaru - 03-01-2010

I need to doubleclick on an application in the notification area of the windows system. ie... right at the bottom you find clock.. and many other notifications.

i need to open a particular windows application from the notification.
if i use dblclick i can open. But if the co ordinates changes, i cant. how do i find in such a way tht no matter where it is , it will click on that particular application ( double click only) and open up the application.

plz help.. tried many ways but nothing works fine.


RE: dblclick help - Saket - 04-01-2010

I am not able to figure out to perform double click there. If I get something will let you know.
however, I can solve your co-ordinate issue -
try the code below. the code is capable to perform the left/right click on any application icon at notification area.
Code:
'Desc- Window Tray
Set oWindow = Description.Create
oWindow("regexpwndclass").value = "Shell_TrayWnd"
'Desc - WinToolBar: Notification Area
Set oSysTray= Description.Create
oSysTray("nativeclass").value = "ToolbarWindow32"
oSysTray("text").value = "Notification Area"

'Get Number of items in Notification area
nItems = Window(oWindow).WinToolbar(oSysTray).GetItemsCount
msgbox nItems

For nItem = 1 To nItems
    'Get Name
    sItemName = Window(oWindow).WinToolbar(oSysTray).GetItem(nItem)
    If  sItemName ="Skype" Then ' if the name is your required Application
        x = Window(oWindow).WinToolbar(oSysTray).GetROProperty ("X")
        y = Window(oWindow).WinToolbar(oSysTray).GetROProperty ("Y")
        Window(oWindow).WinToolbar(oSysTray).Press "Skype",micLeftBtn 'For Left Click
        Window(oWindow).WinToolbar(oSysTray).Press "Skype",micRightBtn 'For Right Click

        'Look For Menu option to open and select
        Set deviceReplay = CreateObject( "Mercury.DeviceReplay" )
        deviceReplay.PressKey VK_UP
        deviceReplay.PressKey VK_UP
        deviceReplay.PressKey VK_RETURN
    End If
Next

hope this helps


RE: dblclick help - milindsd - 04-01-2010

Here is the code which is capable of doing double click

Code:
'Desc- Window Tray
Set oWindow = Description.Create
oWindow("regexpwndclass").value = "Shell_TrayWnd"
'Desc - WinToolBar: Notification Area
Set oSysTray= Description.Create
oSysTray("nativeclass").value = "ToolbarWindow32"
oSysTray("text").value = "Notification Area"

'Get Number of items in Notification area
nItems = Window(oWindow).WinToolbar(oSysTray).GetItemsCount
msgbox nItems

For nItem = 1 To nItems
    'Get Name
    sItemName = Window(oWindow).WinToolbar(oSysTray).GetItem(nItem)
    If  sItemName ="Skype" Then ' if the name is your required Application
        x = Window(oWindow).WinToolbar(oSysTray).GetROProperty("abs_x")
        y = Window(oWindow).WinToolbar(oSysTray).GetROProperty("abs_y")

        objWidth = Window(oWindow).WinToolbar(oSysTray).GetROProperty("width")
        ApproxIconWidth = objWidth / nItems              ''  ApproxIconWidth = TotalWidth / Total items count

        objX =(ApproxIconWidth *  nItem - 1)       ''Formula used -  ApproxIconWidth *  ItemNumber - Gutter (i.e. space between two icons - Let gutter = 1)



        Window(oWindow).WinToolbar(oSysTray).DblClick objX,2,micLeftBtn

    End If
Next



RE: dblclick help - Saket - 04-01-2010

Great Milind! That was Awesome

Kudos to Dr M.


RE: dblclick help - pjavvaru - 04-06-2010

HI saket,

Thanks a lot but this does open the context menu but it doesnot click on the menu item. How can i do?

I dont know what this does ?
Code:
Set deviceReplay = CreateObject( "Mercury.DeviceReplay" )
        deviceReplay.PressKey VK_UP
        deviceReplay.PressKey VK_UP
        deviceReplay.PressKey VK_RETURN
Can you please explain?
Thank You


RE: dblclick help - pjavvaru - 04-06-2010

Thank You Miland.. tht was a great relief... I wish if you could explain. I am new to QTP.

Knowledge is Power. Share it.
Prasanna


RE: dblclick help - Saket - 04-09-2010

Hi Prasanna,
what I was trying to do in my reply was to do the right click on notification icon which should open the contect menu options for the application. once you get the menu you can traverse (using arrow keys) through different options and select(using enter key).
in the code I have used device replay to use arrow keys. you may use the sendkeys method too.

what Milind has done is, getting the exact point (x and y co-ordinates) where the notification icon is there. and does the double click on WinToolbar object.


RE: dblclick help - pjavvaru - 04-12-2010

Hi saket,

I was able to click on the icon of the notification area by using Press but this press only clicks or presses only once and the context menu opens up. But again QTP doesn't recognize send keys or arrow. as it doesnot record anything