Forum Discussion

torus's avatar
torus
Contributor
4 months ago

get a list of processes with specific name

  Is there a better way to get a list of all processes of a certain name (something that has a shorter processing time) than to loop through all processes currently running as shown in the below TC ...
  • torus's avatar
    4 months ago
    function testmememe()
    {
      var processes = GetProcessList("taskhostw");
      var ij = 432;
    }
    
    
    function GetProcessList(processName)
    {
      var p, i;
      var processList = [];
      for (i = 0; i < Sys.ChildCount; i++)
      {
        p = Sys.Child(i);
        if( aqString.Compare(p.ProcessName, processName, false) === 0)
        {
          processList.push(p);
        }
      }
      
      return processList;
    }

    above is the code I ended up with and I guess it works pretty good. It's not too slow. Thanks.