How about --time

Experiences, small talk, and other automation gossip.
marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

How about --time

Post by marcushe » Mon Dec 27, 2010 9:50 am

Many times ,i need to get all forms at local at a time ,then compare them with those gotten latter to find which forms are new created when we use a intelligent and plausible measure . How about to supplement a time property to element ,which represent at what time it is created (like time elapsed after login.). This will help us .
Such as , i get forms and sort. It's very easy to find the new created window and do something

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How about --time

Post by Support Team » Mon Dec 27, 2010 2:47 pm

I am not really sure what you are trying to accomplish; Maybe you could describe your scenario a bit further. We could add a creation timestamp when an element gets created by Ranorex, but if you search again (or use Host.Local.Children) then those elements will be re-created, and there is no way to find out when a (win32) window has been created by the system.

If you periodically update a list of top level elements, you can hold them in a dictionary with a timestamp and update this dictionary (because the Equals() method works correctly even if the Element instance itself is new, but the window it represents already existed at a previous time), and then work with this timestamp.
You can then discard elements which are no longer Valid to keep your list clean, and sort by the timestamp.
I could provide some example code if this is what you want to do.

Michael
Ranorex Team

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Re: How about --time

Post by marcushe » Tue Dec 28, 2010 1:14 am

Thanks,Michael.
We have a task is to launch all programs except OS-relative(Many are not our products and are beyond our conjecture) ,then close them . but it's a bit troublesome to find which window is new created .