# Getting the Index of Object with 4 processes running

Hello,

I am having problems when I open 4 instances of an Excel Application when Testing. The process are as Follows:

Process("EXCEL",2)

Process("EXCEL",3)

Process("EXCEL",4)

The Mapped Name stays under Aliases.EXCEL but I am trying to get the Name to Identify the proper Index of the program.

For Example I want to assign Process("EXCEL",3) to a Variable I have tried the following code with no results.

var excel = Aliases.EXCEL.FullName(Sys.Process("EXCEL").Window("XLMAIN","Microsoft Excel", 3));

var excel = Sys.Process("EXCEL").Window("XLMAIN","Microsoft Excel", 3);

var excel = Aliases.EXCEL.Name("Process","EXCEL",2);

even when I try getting the index it would only get the Index of the first Excel so it would return a value of 1 instead of 3.

I have uploaded a screenshot showing excel having 4 processes opened but unable to find any when running the automation test.

Can anyone point me in the right direction that allows me to get the proper index for excel or any other program.

Thanks in Advance.

JScript sucks compared to Javascript.

Edit : okay okay. There's nothing with Jscript. But we'll need TestComplete to upgrade the compiler for their JScript to match their Javascript implementation.

BUT, that's spilled milk and we shall overcome.

In jscript, FindAllChildren returns not an array-like-object but some other kind of ... thing (aka multi-dimensional VB array)

So:

function findProc(name) { return Sys.FindAllChildren(["ProcessName"],[name],1).

**toArray()**}function findExcel(index) { var arr = findProc("EXCEL") for ( var i = 0 ; i < arr.length ; i++) { if (arr[i].Index === index) { return arr[i] } } }