Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
lwx228
Level VII

How can use JSL to shut down a running program process on the operating system?

I use "windows 7" operating system.
How can I use JSL to shut down the "q.exe" process that is running on the operating system?

2020-06-27_20-28.png

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: How can use JSL to shut down a running program process on the operating system?

It might be better for the q.exe to shut itself down in a more graceful way. JMP has an exit() function for exactly that reason: if you write JSL to do something, it can also close JMP when it is done. 

I've not used the tasklist and taskkill commands, but it looks like they would pull the rug out from under any running program in a rude fashion, just like task manager.

Craige

View solution in original post

3 REPLIES 3
Highlighted
Craige_Hales
Staff (Retired)

Re: How can use JSL to shut down a running program process on the operating system?

It looks like tasklist and taskkill might be what you are looking for.

https://superuser.com/questions/615342/how-to-kill-tasks-in-windows-7-when-even-task-manager-wont-op...

Though if you are not Admin it might not (q looks to be running as admin.) You can probably do this with RunProgram, either calling the commands directly or calling cmd.exe and feeding the commands to the cmd shell.

So...what is it, and why does it need to die?

Craige
Highlighted
lwx228
Level VII

Re: How can use JSL to shut down a running program process on the operating system?

Thank Craige!

Since I'm using JMP to further process the results of "q.exe" calculations, there are multiple q.exe processes in the process.
I want to use JSL to automatically shut down the "q.exe" process.But it didn't work out.

2020-06-28_08-38.png

Shell "taskkill /im q.exe /f"
Shell "taskkill /im cmd.exe /f"
Highlighted
Craige_Hales
Staff (Retired)

Re: How can use JSL to shut down a running program process on the operating system?

It might be better for the q.exe to shut itself down in a more graceful way. JMP has an exit() function for exactly that reason: if you write JSL to do something, it can also close JMP when it is done. 

I've not used the tasklist and taskkill commands, but it looks like they would pull the rug out from under any running program in a rude fashion, just like task manager.

Craige

View solution in original post

Article Labels