Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dblclick help
#1
Not Solved MyBB 
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.
Reply
#2
Not Solved
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

Reply
#3
Not Solved
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
Reply
#4
Not Solved
Great Milind! That was Awesome

Kudos to Dr M.

Reply
#5
Not Solved
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
Reply
#6
Not Solved
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
Reply
#7
Not Solved
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.

Reply
#8
Not Solved
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)