It is currently February 24th, 2020, 8:45 am

RainRestart

Share and get help with Plugins and Addons
User avatar
jsmorley
Developer
Posts: 20275
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

RainRestart

Post by jsmorley »

RainRestart

ftp://uzaeagle.serveftp.com/rainmeter/RainRestart.zip

RainRestart.exe will kill any running Rainmeter.exe processes, wait for two seconds and restart Rainmeter.

The program can be used as a "helper" in a skin in Rainmeter or as a stand alone Windows application. If running in Windows, create a shortcut to the program so you can add the required parameter.


Usage:

RainRestart [path and filename of Rainmeter.exe]
(Parameter is required)

Example:

RainRestart "C:\Program Files\Rainmeter\Rainmeter.exe"
(The parameter is enclosed in quotes)


RainRestart is written in AutoIt3 and is completely free for any use. Source code is included.

AutoIt3 can be downloaded at: http://www.autoitscript.com/autoit3/downloads.shtml

Source code for RainRestart:

Code: Select all

;================================================
If $CmdLine[0] = 0 then
  MsgBox("","RainRestart Error","RainRestart requires the path and executable of Rainmeter.exe as a parameter!")
  Exit
EndIf
$Rainmeter = ProcessExists("Rainmeter.exe")
If $Rainmeter Then
  ProcessClose($Rainmeter)
  sleep (2000)
  ShellExecute($CmdLine[1])
EndIf

Exit
;================================================
dragonmage
Developer
Posts: 1286
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: RainRestart

Post by dragonmage »

So you getting comfortable with Auto-It jsmorley? Ready for some gui stuff yet?
User avatar
jsmorley
Developer
Posts: 20275
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRestart

Post by jsmorley »

dragonmage wrote:So you getting comfortable with Auto-It jsmorley? Ready for some gui stuff yet?
Yeah, the GUI stuff in it is quite strong. You could do about anything with it. I would prefer doing GUI stuff in PHP with ByteRun or one of the other wrappers for PHP which lets you do Windows applications. I like PHP and although AutoIt is easy and quick, you don't learn much really. It's like:

Call Windows API with parms
check result
Call another Windows API with parms
exit

;-)

PHP, JQuery, AJAX, .NET, Rails... Those are things it pays to keep learning and learning.
dragonmage
Developer
Posts: 1286
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: RainRestart

Post by dragonmage »

Well there's an idea I had originally wanted someone to make with AHK, but if you could do it with Auto-It...
Rainmeter Theme Switcher
Arne Anka
Posts: 102
Joined: April 18th, 2009, 11:31 am
Location: Denmark

Re: RainRestart

Post by Arne Anka »

dragonmage wrote:Well there's an idea I had originally wanted someone to make with AHK, but if you could do it with Auto-It...
Rainmeter Theme Switcher
Why not use jsmorley's Config Toggle?
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
User avatar
jsmorley
Developer
Posts: 20275
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRestart

Post by jsmorley »

dragonmage wrote:Well there's an idea I had originally wanted someone to make with AHK, but if you could do it with Auto-It...
Rainmeter Theme Switcher
The only way a "theme switcher" would work would be to have an application which modified the Rainmeter.ini, then restarted Rainmeter. Which skins are loaded by Rainmeter is driven by the "Active" line for each skin in Rainmeter.ini. (Active=1, it loads the skin, Active=0, it doesn't) The only sensible approach is:

Have a program which when run:

1) Asks for a name and saves the current setup as a "Theme". It would save the current Rainmeter.ini file to a folder "\Themes\ThemeName", creating the directory if needed. The skins themselves would remain where they are, so you don't have to duplicate them all over the place causing version issues.

2) Displays a list of subfolders under "\Themes" and when one is selected stop Rainmeter, copy the Rainmeter.ini file from that folder to the Rainmeter home directory and restart Rainmeter. We would have to do the copy while Rainmeter is stopped, as Rainmeter writes the current setup to Rainmeter.ini when it shuts down.

We would also need a ThemeSwitcher.cfg file where we would track the currently loaded theme so changes made manually (position, transparency, draggable, etc.) while the skin is loaded are copied "back" to the Theme folder when a theme switch is made. Otherwise changes will be lost on the next switch of themes. I'd have to do some testing, but I suspect a user could also break the whole thing if they aren't careful what they do manually to Rainmeter.ini while a theme is "loaded".

Unfortunately you can't drive Rainmeter by the command line as Rainmeter.exe doesn't seem to have enough sense to get out of it's own way. If you run Rainmeter.exe when it is already running, it just loads a complete second copy of Rainmeter, including all the skins defined as "Active" in Rainmeter.ini (just overlaying fresh copies of the skins on top of the ones already running). So you are using twice the CPU and twice the memory for nothing. Plus, I you can't "load" or "unload" a skin from the command line in any case. It's just driven by what is in Rainmeter.ini

I am open to messing with this if you have any thoughts though. It would be cool. I do have "themes" I use now manually, when I want a "dark" desktop, or my Orangy/Brown skins, etc.
dragonmage
Developer
Posts: 1286
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: RainRestart

Post by dragonmage »

Yeah, that was the whole concept. I thought I outlined it in the donationcoder post.
It doesn't have to modify the rainmeter.ini. Just keep multiple copies of it.

On your second point, it would have to stop Rainmeter, then copy the current ini to the proper storage folder before copying the newly selected one to the Rainmeter folder. That way any changes you made to positioning and such on the current "theme" would be saved.

This would also allow us to setup initial config positioning,(include a rainmeter.ini with your theme package) that the end user could then modify. That way everything doesn't have to start in the top left corner.
User avatar
jsmorley
Developer
Posts: 20275
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRestart

Post by jsmorley »

I actually hadn't read the post you linked to until I had written my post. I should have, and my post could have been a lot shorter, like "yeah, something like that!". ;-)
dragonmage
Developer
Posts: 1286
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: RainRestart

Post by dragonmage »

I'm sure we can get the devs to add in a commandline argument to exit rainmeter.
User avatar
jsmorley
Developer
Posts: 20275
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RainRestart

Post by jsmorley »

What do we do about this scenario:

The user saves his current setup as a "Theme A". Now at any point in the future he manually unloads and loads skins, maybe testing some stuff he got from here or DevArt, maybe just unloading skins so he has screen real estate while he works on a new one. Then, he decides he wants to load his "Dark" theme, so he uses the program and loads it. The current, manually changed, probably not what he wants to save at all, is saved as "Theme A" as it is the "current theme".

It's not going to work to just assume that the currently loaded theme should be saved back when a switch is made. We are going to have to say "Your current theme is blah, do you want to save before loading a new theme?" Yes?
Last edited by jsmorley on June 6th, 2009, 5:27 pm, edited 1 time in total.