It is currently October 21st, 2021, 3:14 pm

Closing an Application via Rainmeter

Help with creating, editing & fixing problems with skins
User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

Closing an Application via Rainmeter

Post by cwfrizzell »

I have a skin that allows me to open, monitor and close particular applications based on this thread:
https://forum.rainmeter.net/viewtopic.php?f=5&t=4194. The skin works fine for all applications with one exception: the code to close calculator.exe does not respond. Here's the relevant code:

Code: Select all

[MeasurePID7]
Measure=Plugin
Plugin=Process.dll
ProcessName=calculator.exe
UpdateDivider=2
IfBelowValue=1
IfBelowAction=[!SetOption MeterCalc ImageName "Off.png"][!UpdateMeter *][!Redraw]
IfAboveValue=0
IfAboveAction=[!SetOption MeterCalc ImageName "On.png"][!UpdateMeter *][!Redraw]

[MeasureCloseCalc]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=taskkill /IM calculator.exe

[MeterCalc]
Meter=Image
ImagePath=#ROOTCONFIGPATH#\@Resources\
X=40r
Y=2
LeftMouseUpAction=calc.exe
MouseScrollLeftAction=[!CommandMeasure MeasureCloseCalc "Run"]
ToolTipText="Calculator"
MouseActionCursor=1

[MeterCalcText]
Meter=String
X=2r
Y=5
FontFace=Agency FB
FontSize=14
FontColor=255,255,255
StringStyle=Normal
AntiAlias=1
Text=CALC
I have tried using the full path and calc.exe without any luck. This is a Win10 (64) machine using Rainmeter 4.5.2.

Any suggestions?

Thanks in advance!
Cheers!

Chuck
User avatar
jsmorley
Developer
Posts: 22372
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Closing an Application via Rainmeter

Post by jsmorley »

Code: Select all

[MeasureCloseCalc]
Measure=Plugin
Plugin=RunCommand
Program=taskkill.exe
OutputType=ANSI
Parameter=/F /IM calculator.exe
Seems that the new calculator requires the /F parameter to close it. Also, no need to fire up Powershell for this.

This is likely due to the fact that the calculator is now a "windows app" and all the old calc.exe and calculator.exe ways of calling it are really just "stubs" that load the new app. I suspect that RunTimeBroker is holding open the app when you try to close the "stub", and you have to force kill it to make them let go.
User avatar
cwfrizzell
Posts: 77
Joined: August 10th, 2009, 9:03 pm

Re: Closing an Application via Rainmeter

Post by cwfrizzell »

jsmorley wrote: September 15th, 2021, 3:05 pm

Code: Select all

[MeasureCloseCalc]
Measure=Plugin
Plugin=RunCommand
Program=taskkill.exe
OutputType=ANSI
Parameter=/F /IM calculator.exe
Seems that the new calculator requires the /F parameter to close it. Also, no need to fire up Powershell for this.
That works. Thanks!
Cheers!

Chuck