Forum Discussion

Don's avatar
Don
Contributor
7 years ago

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 N...
  • KSQian's avatar
    KSQian
    7 years ago

    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]
        }
      }
    }