Forum Discussion

socc3rpr0's avatar
socc3rpr0
Occasional Contributor
7 years ago

How Do I Find A Mapped Object When It's Values Change

I have mapped an object on the screen, but every time I launch the desktop application and want to click on the object it can't find it because its WPFControlText string changes everytime. The object is mapped the following way:

function ReceiveAllSettings()
{
    var btn = Aliases["Architect"]["HwndSource_ShellView"]["ShellView"]["RibbonWindowContentHost"]["MousePanningDecorator"]["NewPaneNotifyingXamDockManager"]["SplitPane"]["TabGroupPane"]["MultiSelectTreeView"]["TreeviewitemIdVenuecollectionkey8275cba680"]["StackPanel"]["StackPanel"]["Button"]["Image"];
    btn["Click"]();
} 

The property that always changes is "TreeviewitemIdVenuecollectionkey8275cba680" specifically the numbers I highlighted in red and everything else stays the same. How would I go about finding this particular object every time I launch my application? Any guidance will be appreciated. 

2 Replies

  • dmiscannon's avatar
    dmiscannon
    Frequent Contributor

    Replace the text in red with * in both your name mapping and code. You also may want to review this.

    • socc3rpr0's avatar
      socc3rpr0
      Occasional Contributor

      That was it. I had to go into the name mapping and edit the conditions of the property to be any string with *. Thanks !