Normally, if Rainmeter worked as expected (yeah, I have some uncomfortable things to say about this scenario, in particular, but I'll abstain), this should work every time:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
OnCloseAction=[!CommandMeasure MeasureRun "Run"]
---Measures---
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program="C:\Program Files\Rainmeter\Rainmeter.exe"
Parameter=!LoadLayout "Test"
---Meters---
[MeterTest]
Meter=STRING
X=0
Y=0
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text="Test"
This assumes the above code is a "Test\Test.ini" skin in your skins folder and that you also saved the layout (called "Test" as well) with this skin loaded in your layouts folder. What this does is reload the "Test" layout every time the skin or Rainmeter is closed. The thing is, while this works no problem when unloading the skin, it should work every time when exiting Rainmeter, but it doesn't: in my case I must first unload the skin (and let it reload) 3 times and only then it will also reload when exiting Rainmeter from the skin's context menu. Even so, it seems that when exiting Rainmeter from the system tray, the process doesn't reload Rainmeter and the layout containing this skin again - although it should. Maybe it's about the delays involved in running the measure, I don't know.
Why I didn't use
["C:\Program Files\Rainmeter\Rainmeter.exe" !ActivateConfig "Test" "Test.ini"], you may ask? Simple: because they don't work. I thought it was the placement of quotes in the parameters at fault, so I tried various combinations. I don't recommend trying that yourself, as you might unwantedly create some folders in your Rainmeter installation folder, or have an error about writing to the Rainmeter folder, or even have 2 Rainmeters in system tray, LOL. I might be missing something here, but in my attempts I never managed to make this direct bang work when exiting Rainmeter. To make it work when unloading the skin is trivial, so it doesn't count.
Maybe others can get to the bottom of this, because I couldn't - and frnkly I became a bit annoyed by the fact that things that should work don't, i this case.
Bottom line is, assuming the above code is made to work in every test case scenario, the only thing required would be to protect the .INI file and the layout file, along with Rainmeter itself from unauthorized modification. There would be no need to run Rainmeter as a service at all, as Rainmeter and the skin would reload every time the user attemps to unload it or close Rainmeter.