Forum Discussion

sergi's avatar
sergi
Contributor
11 years ago
Solved

Use FindChild for MenuItems with "_" in WPControlText

Hi,

I want to use built-in FindChild function to find the items in the application menu.

I'm trying the following tod o it the following way:



Sys.Process("ApplicationNmae").FindChild(new Array("ClrClassName", "WPFControlText"), new Array("MenuItem", "File"))



The problem is that the WPControlText is actually "_File" instead of "File".



Has anyone any idea of how to overcome this? (I can't provide beforehand the position of "_" character).

  • Ok so I do something similar to this but I have a pretty length set of procedures to find items by text so I'll keep it as simple as I can.



    Sys.Process("ApplicationNmae").FindChild(new Array("ClrClassName", "WPFControlText"), new Array("MenuItem", "*"))



    Return all objects into an array and check the MenuItem property of each item individually stripping the _ and any other invalid characters from the value.



    Not sure what language you are using but I can provide an example if you'd like.

12 Replies