Jump to content
Sign in to follow this  
DanielTyrkiel

Newbie is Learning 002: How to check all visible class instances?

Recommended Posts

DanielTyrkiel

I'm working with a JAVA software that resides in an IE frame. It assigns class instances dynamically.

Here's a piece of script that I wrote today to read all visible class instances and storing it into an array.

It works if the second instance is different than the first one, but obviously exits the loop when the second one is the same as the first one.

What would be a good logic to exit the class reading loop when all visible classes have been read and the first one has been reached?

Here's my code:

#include <Array.au3>


Local $window = WinActivate("http://loma25.loma.co.uk - Live, UK - Loma UK, AUL Environment - Microsoft Internet Explorer", "") ; activate the window we want to check
Local $sControl = ControlGetFocus($window, "") ;read the first class instance visible
Local $avArray[1] ;create the array to work with

$avArray[0] = $sControl ;populate the first line with the first control in view

Local $i ;this is just a counter
For $i = 1 To 10
ControlSend($window, "", $sControl, "{TAB}") ;tab to the next control in view
$sControl = ControlGetFocus($window, "") ;read the control in focus
Local $SearchResult = _ArraySearch($avArray, $sControl) ;check if the control we read is the same as the first one
If $SearchResult = 0 Then ExitLoop ;exit the loop if it is the same
_ArrayAdd($avArray, $sControl) ;add it to the array

Next

_ArrayDisplay($avArray, "all instances") ;show the result
Edited by DanielTyrkiel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×