It is currently April 23rd, 2024, 10:51 pm

!RainmeterQuit

Release announcements and important news from the developers.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

!RainmeterQuit

Post by jsmorley »

Rainy,

I see you have added a new bang "!RainmeterQuit". I assume this was at least in part a way to provide RainThemes a way to stop Rainmeter without "killing" it, so the shadow icon would not be left behind.

I compiled and tested the a new build using the latest svn revision and the bang works great. I will be modifying RainThemes to use it today. If you are planing to include this in a second RC or the release you can use the new revision or stay with the current one if you are going to use 139 to build the release.

One request. Currently the bang will cause a Windows dialog box saying "Rainmeter is not currently running, can't send bang" if Rainmeter is not running when the command "Rainmeter.exe !RainmeterQuit" is used. Could this be removed? The reason is that I stop all instances of Rainmeter in RainThemes with a process loop a bit like this:

While ProcessExists(Rainmeter.exe)
ProcessKill(Rainmeter.exe)
WEnd

If I change this to:

While ProcessExists(Rainmeter.exe)
ShellExecute("Rainmeter.exe !RainmeterQuit")
WEnd

I am afraid that a second call to the ShellExecute statement could happen before Rainmeter is able to fully shutdown, and the user could get that Windows dialog, which would be really annoying.

Even if I put a "sleep" of a second or two in the loop, we can't be certain that they would never get the dialog if for instance their cpu was very busy with other non-Rainmeter tasks. There are other more "positive" approaches I could take, but I am hesitant to slow down the "loading" of a theme as it will effect the user experience.

I can see a dialog being important for almost any other bang to warn the user it didn't happen. But in this case "it didn't happen" is really ok and I don't see that the user absolutely needs to be told that their request to kill Rainmeter didn't succeed because Rainmeter was already dead.

I know this may be a generic error routine that warns the user if a bang from the command line is unsuccessful because Rainmeter isn't running. If a check like:

if BangError != "!RainmeterQuit" then
ErrorRoutine
EndIf

isn't possible, then I may just have to live with it and see what I can do some other way, but if is can be done it would be nice.

Edit: I just tested it, and it threw about 200 dialog boxes on the screen before Rainmeter was able to fully shut down. ;-) Part of the problem was mine, as I just can't run it in that tight a loop as I basically take ALL the CPU until Rainmeter is gone, and there isn't any CPU left to give Rainmeter to actually run its close routines. This approach was fine with the "kill" method, but not when you expect the target program to have time to do something. I added a few milliseconds of sleep in the loop and the problem seems to have gone away as I use almost no CPU that way and Rainmeter closes almost instantly. Still, this is a potential problem and I wonder if you could look at it.
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: !RainmeterQuit

Post by dragonmage »

Is the loop needed? You can't just send the quit bang to the Rainmeter.exe that is up two folders from the currently running RainThemes?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: !RainmeterQuit

Post by jsmorley »

dragonmage wrote:Is the loop needed? You can't just send the quit bang to the Rainmeter.exe that is up two folders from the currently running RainThemes?
It only stops one instance of Rainmeter. If a user is running more than one for some reason, it has no way to know "which" one to stop. I do send the bang to the Rainmeter.exe two levels up from RainThemes, but even then there could be two instances running. (probably by accident, but even so I want to be sure I stop them all)

I could take the loop out and assume that there would never be two copies of the SAME Rainmeter.exe running and that someone running two instances (for two monitors for example) would have two different versions of Rainmeter installed in different directories, but Rainy has added the ability to start Rainmeter with a command line parm pointing to individual Rainmeter.ini's

I mean in a perfect world I would be able to tell which instance they mean to load the theme in, and only stop that one, but there is no way with the current architecture. The only option would be to have a dialog in RainThemes that says "you have two Rainmeter.exe instances, which PID do you want to load this theme in?" but there is no way even the user would know that, much less RainThemes, and it would force us back to using "kill" which is what we are trying to eliminate.

If we take out the error dialog, it won't matter a bit that I might tell Rainmeter to close 2 or 3 times before it has a chance to actually do so. It's the "I'm doing it, stop nagging me!!! " error dialog I want to get rid of.. ;-)
User avatar
Rainy
Developer
Posts: 42
Joined: April 13th, 2009, 8:20 am

Re: !RainmeterQuit

Post by Rainy »

Yes, I can remove the error dialog in this case.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: !RainmeterQuit

Post by jsmorley »

Rainy wrote:Yes, I can remove the error dialog in this case.
Excellent...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: !RainmeterQuit

Post by jsmorley »

I have committed the change to RainThemes to the svn.