Forum Discussion

DevaV's avatar
DevaV
Contributor
14 years ago

Find all children

Hi,

I want to find all children of system by its process name, but when i use Find all children it returns nothing. The code is as follows.



var children = Sys.FindAllChildren("ProcessName","IEXPLORE",1)

Log.Message(children.Length)





I want to know how many instance of same process is running, for eg: If i open more than one iexplore and if I want to know how many iexplore I've opened how can i get that no of process.



Kindly provide some solution for this problem.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Deva,



    Not sure what scripting language you are using, but if it is JScript (or C++Script or C#Script that are JScript-based) that is case-sensitive, you may instead of

    Log.Message(children.Length)

    try

    Log.Message(children.length) // Length was changed to length



    Does it help?
  • Hi Alexei Karas,



    I tried with both. Acutally when i am trying evaluate 'children' after its execution, it gives nothing.
  • Hi,



    You should convert FindAllChildren's result to a JScript array by using its toArray method.



    var children = Sys.FindAllChildren("ProcessName","IEXPLORE",1).toArray()
  • Hi Jared,



    I tried with toArray now its works fine.



    Thanks. :)