| View previous topic :: View next topic |
| Author |
Message |
mollusk
Joined: 13 Dec 2006 Posts: 5
|
Posted: Mon Dec 18, 2006 7:13 am Post subject: Trouble accessing Windows notification tray area. |
|
Hi,
I'm trying to write a test to right-click on an icon in the Windows notification tray and then identify a context menu item by text and left-click on that.
What I have so far looks something like:
Code: click into code to enlarge
hTaskTray = r.FormFindClassName("Shell_TrayWnd", 1, TRUE, TIMEOUT)
hNotifyTray = r.FormFindChildClassName(hTaskTray, "TrayNotifyWnd", 1)
hNotifyArea = r.FormFindChildClassName(hNotifyTray, "ToolbarWindow32", 1)
# Print the number of notification area icons
print r.ToolStripGetItemCount(hNotifyArea)
# Select Windows volume control icon and select the second item on
# its menu
print r.ToolStripSelectPosition(hNotifyArea, 1, 2) # CRASHES PythonWin
I suspect I'm not using ToolStripSelectPosition() correctly as there is no possibility of specifying right-clicking on the icon. Unfortunately I'm not familiar with .Net so a lot of the terminology itself is new to me (things like forms, controls, elements, etc...).
Cheers. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Dec 19, 2006 12:34 am Post subject: |
|
Please try this sample, i used it for the Touch Pad, but it should also work with the volume control:
Code: click into code to enlarge
hTaskTray = Ranorex.FormFindClassName("Shell_TrayWnd", 1, True, 5000)
trayElement = Ranorex.ControlGetElement(hTaskTray)
notifyElement = Ranorex.ElementFindChild(trayElement, Ranorex.ROLE_SYSTEM_CLIENT, "", 'TrayNotifyWnd')
touchButton = Ranorex.ElementFindChild(notifyElement,Ranorex.ROLE_SYSTEM_PUSHBUTTON, 'Touch Pad')
if touchButton == None:
print 'Touch button not found'
return 1
Ranorex.MouseClickElement(touchButton,Ranorex.MOUSE_RIGHT_BUTTON)
Ranorex.Sleep(100)
Ranorex.ContextMenuSelectItemText('&Info')
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
mollusk
Joined: 13 Dec 2006 Posts: 5
|
Posted: Tue Dec 19, 2006 1:53 am Post subject: |
|
Thanks Jenö! Worked a treat.
Seems I'm going to have to learn a lot more about the Windows API to be competent at this
Just one more question: Is it possible for Ranorex.ElementFindChild() to accept a regular expression of some form as the 'name' parameter? The name of the notification app I'm testing changes depending on the application's state. I'm sure I can find another work around if this is not possible.
Cheers. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Dec 19, 2006 11:10 pm Post subject: |
|
| mollusk wrote: |
| Is it possible for Ranorex.ElementFindChild() to accept a regular expression? |
Some other user also asked us about regular expressions.
We will support this feature in V1.1 or in V1.2, at the beginning of next year.
But i'm sorry, i cannot write you an exact time now.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
mollusk
Joined: 13 Dec 2006 Posts: 5
|
Posted: Thu Dec 21, 2006 12:58 am Post subject: |
|
| admin wrote: |
| We will support this feature in V1.1 or in V1.2, at the beginning of next year. |
Sounds great. Thanks again. |
|
| Back to top |
|
 |
|