Ranorex

Trouble accessing Windows notification tray area.

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython
View previous topic :: View next topic  
Author Message
mollusk



Joined: 13 Dec 2006
Posts: 5

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
mollusk



Joined: 13 Dec 2006
Posts: 5

PostPosted: 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 Smile

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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
mollusk



Joined: 13 Dec 2006
Posts: 5

PostPosted: 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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum