It is currently December 7th, 2021, 11:59 am

Can I close an application with Rainmeter?

Help with creating, editing & fixing problems with skins
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Can I close an application with Rainmeter?

Post by Sunspot2 »

Searching in the Documentation I couldn't find that:

Is it possible to close an application or kill a process with Rainmeter?
poiru
Developer
Posts: 2871
Joined: April 17th, 2009, 12:18 pm

Re: Can I close an application with Rainmeter?

Post by poiru »

You could use nircmd (http://www.nirsoft.net/utils/nircmd.html) and then

Code: Select all

!execute ["PATH\nircmd.exe" killprocess process.exe]
Remember to replace PATH with path to nircmd.exe
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I close an application with Rainmeter?

Post by jsmorley »

Not with native Rainmeter, but there are tons of little "kill" utilities out there (or an AutoIt3 / nircmd script) that could be used with your skin like this:

LeftMouseAction=!Execute ["KillApp.exe" "processnametokill"]
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Can I close an application with Rainmeter?

Post by Sunspot2 »

Nice. TY all!
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Can I close an application with Rainmeter?

Post by dragonmage »

Also if you prefer to be nice about it, some applications have a commandline argument to exit the application, you would send it like any command.
User avatar
sl23
Posts: 929
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Can I close an application with Rainmeter?

Post by sl23 »

I don't suppose Rainmeter has been updated to support this?

EDIT: I found out how to do this via .bat file. But would be a good to know if Rm has had this function added or not.
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I close an application with Rainmeter?

Post by jsmorley »

sl23 wrote: July 31st, 2021, 10:22 am I don't suppose Rainmeter has been updated to support this?

EDIT: I found out how to do this via .bat file. But would be a good to know if Rm has had this function added or not.
It does not. Rainmeter has no native way to close an application other than itself. There is no good safe way to do that, since a great many processes in Windows would be fairly disastrous to kill while Windows is running.

I would think a Powershell or cmd.exe Taskkill command in a RunCommand measure would work good for this. I'd be hesitant to call an external .bat file.
User avatar
sl23
Posts: 929
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Can I close an application with Rainmeter?

Post by sl23 »

jsmorley wrote: July 31st, 2021, 12:01 pm It does not. Rainmeter has no native way to close an application other than itself. There is no good safe way to do that, since a great many processes in Windows would be fairly disastrous to kill while Windows is running.

I would think a Powershell command in a RunCommand measure would work good for this. I'd be hesitant to call an external .bat file.
Hmm, ok, Thanks, I'll look into that. Perhaps it's easier to just stick with NirCMD then?
User avatar
jsmorley
Developer
Posts: 22419
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Can I close an application with Rainmeter?

Post by jsmorley »

sl23 wrote: July 31st, 2021, 12:07 pm Hmm, ok, Thanks, I'll look into that. Perhaps it's easier to just stick with NirCMD then?
Nah, it's easy to do in Powershell or cmd.exe using RunCommand.
User avatar
sl23
Posts: 929
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Can I close an application with Rainmeter?

Post by sl23 »

Powershell scares me though! O.O :o :lol: