Forum Discussion

Manfred_F's avatar
Manfred_F
Regular Contributor
8 years ago

Name Mapping: conditional mode

Has anybody used conditional mode in TC11?

 

I just tried, but it didn't work.

I've got a Dialog with two alternative WndCaptions, so Contitional Mode would be the right way to handle it.

 

The alias has got a condition for WndClass, WndCaption and Exists.

I edited the mapping and entered an OR condition to the WndCaption.

After that TC couldnot find any of the both Dialog alternatives, even the one it could identify before was recognized no more.

Then I removed the additional condition, but TC could find nothing. I tried to remove the conditional mode, but TC doesn't let me do this for an item that can't be identified on Screen.

So I compared the NameMapping.tcNM to the former Version and found an additional filter line there. After removing it, the conditional mode was gone and TC could find the first Dialog Version as before.

 

 

Then I played around a Little bit.

I enabled cm for "sys" - no Problem.

Next, I enabled it for the process ("pva") - OK.

Then, I tried the next Level, my main window. The mapping conditions comprise WndClass, WndCaption and Exists. When I turned on cm, it said that the criteria would not provide unique identification (which they did in Basic mode). When I save this, the main window is not recognized anymore.

 

AAnybody else has experiences with this?

15 Replies

  • Bobik's avatar
    Bobik
    Frequent Contributor

    Try do not use 'Exists' property in NameMapping.

    Example of correct mapping attached.

    I've tried it with notepad window and it works fine.

     

     

     

    • Manfred_F's avatar
      Manfred_F
      Regular Contributor

      Bobik:

      You've got it.

       

      When I remove the .Exists-Property in conditional mode, it works.

      Intresting: trying to re-add the .Exists property Fails. The property is not available in the selection list. When I type the Name instead, I get an error "Invalid property".

       

      Why? Seems to be a BUG

       

      Sadly, I can't avoid using the .Exists poperty in Aliases: my AUT uses to Keep controls of closed Dialogs in the tree, just making them invisible. So, I Need the .Exists to determine, what is real and what is old stuff.

       

      • Bobik's avatar
        Bobik
        Frequent Contributor

        Why don't you use 'Visible' property?

        Also TC11.31 Name mapping can ignore invisible object when there is visible one.

        see 'Tools|Options > Engines>NameMapping>Search for visible objects first' option. It could be useful for you.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Sounds strange...

    I used conditional namemapping exactly with TC11 several times and it worked for me.

    Can you provide a screenshot of the problematic namemapped/aliased element?

  • baxatob's avatar
    baxatob
    Community Hero

    Hm, I use conditional name mapping since version 9 and never faced any significant problem.

  • Ravik's avatar
    Ravik
    Super Contributor

    Hi,

     

    I am using conditional NameMapping in TC 11, it's work fine for me.

     

    You may try to add first mandatory property and then letter add that conditional property.