1 Reply Latest reply: May 21, 2014 12:59 AM by Apod42 RSS

    Close previously opened application

    Apod42 Community Member

      Using Javascript, I do this:

      var file = File('C:/myapplication.exe'); file.execute(); 

      It opens the application. After I open it, I need it closed. I use this:

      file.close(); 

      No luck. What am I doing wrong? I use this in a Photoshop script (jsx).

        • 1. Re: Close previously opened application
          Apod42 Community Member

          Found the solution:

           

          Not sure which versions are supported but you can

          app.system("Taskkill /F /IM myapplication.exe");

          This is of course windows only. If this does not work you can write Taskkill /F /IM myapplication.exe to a bat file and execute that file.

          var bat = new File("C:/killmyapp.bat"); bat.open("w"); bat.writeln("Taskkill /F /IM myapplication.exe"); bat.close(); bat.execute(); 

          This is basically same as terminating application from windows task manager.