Forum Discussion

Dewayne_Pinion's avatar
Dewayne_Pinion
Contributor
10 years ago

Clicking a button after finding WndCaption

Greetings, I am trying to write a routine to click any button within my AUT by calling the routine and passing it the button's WndCaption property. However, I am running into an issue, that the butt...
  • HKosova's avatar
    10 years ago

    You can wildcard Test as ?T?e?s?t to account for possible hot-key ampersands in the string. Just be aware this may produce false positives.

     

    sCaption = AddWildcards("Test")
    Call ClickMyButton(sCaption)
    ...

    ' Adds ? before each character in a string, for example: ' Test -> ?T?e?s?t Function AddWildcards(Str) Dim re : Set re = New RegExp re.Pattern = "." re.Global = True AddWildcards = re.Replace(Str, "?$&") End Function