Get all children in UIA lists


Alberto Buffolino
 

Hi all,
the question is: is there a way to get all children/list items in UIA lists (like UIItemsView in Windows 10 explorer), instead of the visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto


Abdel
 

Hi Alberto,

I don't think UIA is the best way to find all the elements, including the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId, True)

Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA lists (like UIItemsView in Windows 10 explorer), instead of the visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto




Aleksey Varfolomeev
 

Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:

Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,

True)

Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto









Abdel
 

Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G. Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_ControlTypePropertyId, UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition (visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition (condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle (focus.windowHandle)
# Let's list the elements using our condition and UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,

True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto









Abdel
 

Of course, UIAHandler.handler.clientObject can be abbreviated as follows:

clientObject = UIAHandler.handler.clientObject

Kind regards,
Abdel.

Le 13/12/2020 à 11:30, Abdel a écrit :
Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G. Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_ControlTypePropertyId, UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition (UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition (visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition (condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle (focus.windowHandle)
# Let's list the elements using our condition and UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,

True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto












Aleksey Varfolomeev
 

Hello.

yes, this works in explorer, however i get only 24 results, these are
which can be seen with object nav.

but this doesn't work in apps like your phone.

could someone, maybe you Abdel could help, what should be done to make
it working in for example your phone?


thank you.

2020-12-13 15:21 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:

Of course, UIAHandler.handler.clientObject can be abbreviated as follows:

clientObject = UIAHandler.handler.clientObject

Kind regards,
Abdel.

Le 13/12/2020 à 11:30, Abdel a écrit :
Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G.
Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_ControlTypePropertyId,
UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the
visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition
(visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition
(condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle
(focus.windowHandle)
# Let's list the elements using our condition and
UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can
also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,



True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto

















Alberto Buffolino
 

Aleksey Varfolomeev, il 13/12/2020 17.44, ha scritto:
could someone, maybe you Abdel could help, what should be done to make
it working in for example your phone?
Alberto:
I think Abdel would suggest to use a way like shell API, that in fact what I used in ColumnsReview, thanks to contribution of Abdel and others.
I'm doing a bit of refactoring, so I asked for an UIA solution, but the answer seems negative :)
Alberto


Abdel
 

Hi Aleksey and all,

I'm not using NVDA nor the Windows operating system on my phone.

I'm using an iPhone with iOS and VoiceOver.

Unfortunately, I can't do a test.

@Alberto:

With the current IUIAutomation6 version of UIA, it is not yet possible.

According to Jamie, in one of his old posts, he said that this limitation allowed a better gain in terms of performance.

Thanks.

Kind regards,
Abdel.

Le 13/12/2020 à 17:44, Aleksey Varfolomeev a écrit :

Hello.

yes, this works in explorer, however i get only 24 results, these are
which can be seen with object nav.

but this doesn't work in apps like your phone.

could someone, maybe you Abdel could help, what should be done to make
it working in for example your phone?


thank you.

2020-12-13 15:21 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Of course, UIAHandler.handler.clientObject can be abbreviated as follows:

clientObject = UIAHandler.handler.clientObject
Kind regards,
Abdel.

Le 13/12/2020 à 11:30, Abdel a écrit :
Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G.
Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_ControlTypePropertyId,
UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the
visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition
(visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition
(condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle
(focus.windowHandle)
# Let's list the elements using our condition and
UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can
also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,



True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto














Aleksey Varfolomeev
 

no,no, there is a app called "your phone" on windows 10. that was what i ment.

this test also possible with unigram, a telegram client.

2020-12-13 21:50 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:

Hi Aleksey and all,

I'm not using NVDA nor the Windows operating system on my phone.

I'm using an iPhone with iOS and VoiceOver.

Unfortunately, I can't do a test.

@Alberto:

With the current IUIAutomation6 version of UIA, it is not yet possible.

According to Jamie, in one of his old posts, he said that this
limitation allowed a better gain in terms of performance.

Thanks.

Kind regards,
Abdel.

Le 13/12/2020 à 17:44, Aleksey Varfolomeev a écrit :

Hello.

yes, this works in explorer, however i get only 24 results, these are
which can be seen with object nav.

but this doesn't work in apps like your phone.

could someone, maybe you Abdel could help, what should be done to make
it working in for example your phone?


thank you.

2020-12-13 15:21 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Of course, UIAHandler.handler.clientObject can be abbreviated as
follows:

clientObject = UIAHandler.handler.clientObject
Kind regards,
Abdel.

Le 13/12/2020 à 11:30, Abdel a écrit :
Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G.
Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_ControlTypePropertyId,
UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the
visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition
(visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition
(condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle
(focus.windowHandle)
# Let's list the elements using our condition and
UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can
also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,



True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in
UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto



















Abdel
 

OK Aleksey,

I know this apps on windows 10 but I don't use it to connect to my iPhone.

I use iTunes instead.

Kind regards,
Abdel.

Le 13/12/2020 à 19:27, Aleksey Varfolomeev a écrit :
no,no, there is a app called "your phone" on windows 10. that was what i ment.

this test also possible with unigram, a telegram client.

2020-12-13 21:50 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Aleksey and all,

I'm not using NVDA nor the Windows operating system on my phone.

I'm using an iPhone with iOS and VoiceOver.

Unfortunately, I can't do a test.

@Alberto:

With the current IUIAutomation6 version of UIA, it is not yet possible.

According to Jamie, in one of his old posts, he said that this
limitation allowed a better gain in terms of performance.

Thanks.

Kind regards,
Abdel.

Le 13/12/2020 à 17:44, Aleksey Varfolomeev a écrit :

Hello.

yes, this works in explorer, however i get only 24 results, these are
which can be seen with object nav.

but this doesn't work in apps like your phone.

could someone, maybe you Abdel could help, what should be done to make
it working in for example your phone?


thank you.

2020-12-13 15:21 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Of course, UIAHandler.handler.clientObject can be abbreviated as
follows:

clientObject = UIAHandler.handler.clientObject
Kind regards,
Abdel.

Le 13/12/2020 à 11:30, Abdel a écrit :
Hi Aleksey and all,

Thanks, I'll give you an example in Windows File Explorer, E.G.
Documents folder with Windows 10.

Open the Documents folder and then the NVDA Python console.

Then write the following instructions:

import UIAHandler # For importing UIAHandler module.
# Our first condition for list item elements:
condition1 = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_ControlTypePropertyId,
UIAHandler.UIA_ListItemControlTypeId)
# Another condition for listing hidden elements:
noVisible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, True)
# Another condition for listing visible elements:
visible = UIAHandler.handler.clientObject.CreatePropertyCondition
(UIAHandler.UIA_IsOffscreenPropertyId, False)
# We can now build our second condition, which will include the
visible and invisible elements.
condition2 = UIAHandler.handler.clientObject.CreateOrCondition
(visible, noVisible)
# Now let's build our final condition.
condition = UIAHandler.handler.clientObject.CreateAndCondition
(condition1, condition2)
# Let us now point to the UIA element present under the focus.
obj = UIAHandler.handler.clientObject.ElementFromHandle
(focus.windowHandle)
# Let's list the elements using our condition and
UIAHandler.TreeScope_Children (UIAHandler.TreeScope_Descendants can
also be used).
items = obj.FindAll (UIAHandler.TreeScope_Children, condition)
# Let's count them.
items.Length # 35 in my case, while there are actually 1007.
# You can then read each element name as follows:
for i in range(items.Length):
    items.GetElement(i).CurrentName
Hope thie helps.

Kind regards,
Abdel.

Le 13/12/2020 à 04:15, Aleksey Varfolomeev a écrit :
Hello Abdel.

very interesting topic.
i wanted to also find all list items in uia application.
i tried your code, but i am getting some pointer, then i don't know
what to do with it.

could you please write a small code snippet how to find all list items
in listtview?


thank you.

2020-12-13 1:51 GMT+04:00, Abdel <abdelkrim.bensaid@free.fr>:
Hi Alberto,

I don't think UIA is the best way to find all the elements, including
the hidden ones.

With UIA, only currently visible elements are listable.

The following condition doesn't work for scrollable lists with some
items hidden.

UIAHandler.handler.clientObject.CreatePropertyCondition(UIAHandler.UIA_IsOffscreenPropertyId,



True)
Hope this helps.

Kind regards,
Abdel.
Le 11/12/2020 à 19:57, Alberto Buffolino a écrit :

Hi all,
the question is: is there a way to get all children/list items in
UIA
lists (like UIItemsView in Windows 10 explorer), instead of the
visible ones only?
I googled a bit but without success...
Thanks for any answers.
Alberto