Reputation: 1173
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
).
Upvotes: 1
Views: 141
Reputation: 1718
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.
Upvotes: 1