Obtain current title for a window


#1

Matthew Stjohn
September 14, 2016 11:54 ANSWERED
How do I obtain the current title for a window?

I can find the window I want using a selector with a wildcard in the title (e.g. title = “Edit Company*”.

However, in order to find out which Company is being edited, I need to extract the full window title (e.g. “Edit Company ABC123 - The ABC Company”.

Can anyone tell me how to do this?


#2

Andrzej.Kniola September 14, 2016 12:20
Hi Matthew,

One way of doing it:

AttachWindow -> Output window object to a variable (aWindow)

Create a second variable of type UiPath.Core.UiElement named f.e. aWindowAsUiElement

Assign -> aWindowAsUiElement = aWindow

(Window type inherits from UiElement, so this is essentially casting it to the type we need)

Now you can access the window title as a string with aWindowAsUiElement.Get(“title”).ToString


#3

Mihai Badita September 14, 2016 15:45
Or simply use the Get atribute activity.


Is it possible to find a control by this text?
#4

Actually, although Mihai’s suggestion is faster and easier, it works 95% of the time.
In my situation, Andrzej.Kniola’s logic worked for the other 5%. I am talking about getting the title from a SAP Easy Access application. In this scenario, the Get Attribute did not return anything at all.


#5

hi ,

Please follow similar video,

Thanks,
Karthik