Windows - Get list of files in folder (only shows visible)

Class library usage, coding and language questions.
godzillajoe
Posts: 13
Joined: Wed Nov 20, 2013 4:16 pm

Windows - Get list of files in folder (only shows visible)

Post by godzillajoe » Fri Dec 20, 2013 7:58 pm

<deleted>
Last edited by godzillajoe on Tue Mar 11, 2014 6:44 pm, edited 1 time in total.

mebner

Re: Windows - Get list of files in folder (only shows visible)

Post by mebner » Mon Dec 23, 2013 2:21 pm

Hi,

There are no accessible representatives of the not shown elements and this is why Ranorex cannot get them.
You need to scroll the scrollbar to get all your elements.
You can for instance use the "scrollbar[@accessiblename='Vertical Scroll Bar']" element and scroll by using the Set Value -> Value action, you can set it to values from 1 to 100.

I hope this will help you to solve the issue!

Regards,
Markus

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Windows - Get list of files in folder (only shows visible)

Post by krstcs » Mon Dec 23, 2013 2:38 pm

The issue is actually with how Windows loads UI objects.

It uses a method known as "Lazy Loading". This allows the system to use fewer resources because it doesn't have to fetch properties or "draw" items on the UI that are not actually visible. The system knows there is something there, but doesn't need to know anything about it.

And Markus is correct, since Windows doesn't present this information, Ranorex can't get it either.

There are several ways to go about getting all of the objects, but I would guess that Markus's will be the easiest.
Shortcuts usually aren't...

godzillajoe
Posts: 13
Joined: Wed Nov 20, 2013 4:16 pm

Re: Windows - Get list of files in folder (only shows visible)

Post by godzillajoe » Mon Jan 06, 2014 8:56 pm

I was able to get them all by sending an {END} keypress, getting the text of the selected (last) item, then starting at the top and walking down the list (send key {DOWN}, get the current text, send key {DOWN}....) until I hit the last one again. Stored them all in a list. It works but it is slow and a bit hacky.