Forum Discussion

jjorissen's avatar
jjorissen
Occasional Contributor
9 years ago

How to close all open applications except TestComplete without knowing which applications are open?

Hey all,

Is there a possibility to close all open Windows applications (except TestComplete), without knowing up front which applications are open?
I'm using Jscript.

Thanks.

3 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    One method...

    You could use Sys.FindAll, iterate and evaluate the objects returned, and then .Terminate() the desired applications/processes.

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    I think it would be dangerous to do so...

     

    anyway...

     

    I use this delphi script in my librairies to kill a process of which I know the name :

     

    procedure KillProcessus(NomProcessus: string);
    var
      p, IsClosed;
    begin
      p := Sys.FindChild('ProcessName', NomProcessus);
      while p.Exists do
      begin
        p.Close;
        IsClosed:= p.WaitProperty('Exists', False);
        if not IsClosed then
          p.Terminate;
        p:= Sys.FindChild('ProcessName', NomProcessus);
      end;
    end;

     

    you could even try knew processes or loop into all processes and exclude in the processes you want

     

    • jjorissen's avatar
      jjorissen
      Occasional Contributor

      Thanks.

      I've tried out some things, and also used the close & terminate process functionalities for processes which I know.