It is currently May 21st, 2024, 3:02 am

SOLVED: Specifying a config in a bang (command line).

Get help with creating, editing & fixing problems with skins
ZeroCool42
Posts: 4
Joined: September 25th, 2010, 11:54 am

SOLVED: Specifying a config in a bang (command line).

Post by ZeroCool42 »

Hi everyone!

The Rainmeter manual states that to reload an individual config, I simply use the !bang "!RainmeterRefresh (Config)".

Maybe I'm being stupid here, but how do I actually specify the config to be reloaded? For reference, my config is in the skins directory (the kinda my documents one, rather than the program files one) at <SKINS DIRECTORY>\My Theme\Power Meter\Power_copy.ini.

Also, the manual says "The Config and IniFile must exist in the already loaded list of configurations." What does this mean? Surely if the ini file is loaded, that means the config is?

Finally, if possible, can someone also tell me how to run this at the command line? I found a post by "jsmorley", which stated that "C:\Program Files\Rainmeter\Rainmeter.exe !RainmeterRefreshApp" was the correct way to run a !bang from the command line, but this did not work for me. I have however, managed to create a shortcut with a path as follows:

"<Path to Rainmeter directory>\Rainmeter.exe" !RainmeterRefresh *

So would appreciate some clarification on where exactly speech marks should be placed in order to run Rainmeter.exe with the !bang correctly.

Many thanks in advance for any help provided!

ZeroCool42
Last edited by ZeroCool42 on September 25th, 2010, 2:50 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Specifying a config in a bang (command line).

Post by jsmorley »

!RainmeterRefresh is used to refresh a currently running skin. Like all Rainmeter !bangs, it can be run from the command line with:

"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterRefresh ConfigName

ConfigName is given the same as it is in RainBrowser in your "Active" list, or on the Rainmeter system tray context menu. So for instance, I have a config in \Skins\JSMeter\JSWeather, with a skin of 3-Day-Weather.ini. I would refresh this config with:

"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterRefresh JSMeter\JSWeaather

From the command line, Windows wants the path to the executable in quotes if there are spaces in the path/filename. The parameters don't require them.
ZeroCool42
Posts: 4
Joined: September 25th, 2010, 11:54 am

Re: Specifying a config in a bang (command line).

Post by ZeroCool42 »

Dear jsmorely,

My sincerest thanks for you assistance so far! The only problem is that I still can't get it to work.

As I feel it might help, here is a little background, feel free to skip as you see fit!
Essentially, I have a script that modifies a Rainmeter config file directly, (replacing the existing png filename of a meter property with a different one depending on some system conditions - done by getting the script to rewrite that line of the .ini file). So what I want to do is be able to have Rainmeter reload a particular configs ini file when it has changed (this would be done by my script) and thus have the rainmeter skin display the new image file instead of the old one. However, I have other rainmeter configs running, so I don't just want to run !RainmeterRefreshApp or !RainmeterRefresh *.

So far, I have not actually been using the script to test running these bangs from the command line, so the problem doesn't lie with my script.

What I have done is opened a command prompt, cd'ed into my Rainmeter directory and then run Rainmeter.exe !Bang goes here. When testing !RainmeterRefresh commands, I have manually edited a skin, changed a value (i.e. the filename of the .png for an image meter, to make it use a different image), saved the changes and then closed the skin file before running the command. This has then caused the meter to change when using !RainmeterRefresh *, but not when using !RainmeterRefresh ConfigName.

My results have been mixed. !RainmeterAbout and !RainmeterRefresh * work perfectly, performing exactly as expected.

However, actually trying to run !Rainmeter Refresh ConfigName (using a real config name and the config name scheme you specified) has appeared to do nothing. I am running Windows 7 Ultimate and have upgraded to the 1.3 beta (thus, this has been tried with 1.2 and 1.3 r543, but still I cannot get a meter to change when a detail in it's .ini file has been altered unless I use !RainmeterRefresh *.

Any thoughs or advice would be much appreciated, and I am more than willing to give more information if it is required.

Many thanks in advance

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

Re: Specifying a config in a bang (command line).

Post by jsmorley »

I'm kinda stumped. Perhaps you can copy and paste your command line here exactly as you are running it. I note in the last post that you said "!Rainmeter Refresh ConfigName" which seems to have an extra space in !RainmeterRefresh, but since you have it correctly other places, I'm not hopeful it is something this simple.
ZeroCool42
Posts: 4
Joined: September 25th, 2010, 11:54 am

Re: Specifying a config in a bang (command line).

Post by ZeroCool42 »

Okay, below is exactly what I ran, but when I did it again with logging enabled, I found this in the log file (I tried it twice, hence two entries):

DEBUG: (00:56:15.862) Unknown config name: My
DEBUG: (00:56:18.217) Unknown config name: My

Seeing as the name of my config, as it appears in the right-click Rainmeter tray menu is My Theme\ Power Meter it would appear that it doesn't like the spaces in my config name. How can I escape the spaces? Or should I use the windows %20% method to encode a space?

Once again, many many thanks for your help!



Okay, here's what I did, step by step, as broken down as possible...

First I edited a skin (Right click on skin, Edit Skin...)

The skin has the following code:

[PowerMeter]
Meter=IMAGE
X=10
Y=14
ImageName=8.png
AntiAlias=1

I changed ImageName=8.png to ImageName=1.png. Both .png files exist and are in the same folder as the skin .ini.

Then I saved the change and closed the editor (Notepad).


Next, I opened a command prompt (win + r, cmd, Ok)

Then I ran cd "C:\Users\David\My Dropbox\Software\Rainmeter\Rainmeter 1.3"

Then double checked that the config name (i.e. the bit between "Logging" and "Exit" in the right click Rainmeter tray menu) for the config I wanted to refresh was My Theme\Power Meter

Then I ran Rainmeter.exe !RainmeterRefresh My Theme\Power Meter in the command prompt. No errors appeared and a new command prompt appeared on the next line. But the meter didn't change.

Then, in command prompt, I ran Rainmeter.exe !RainmeterAbout, which worked successfully.

Then, in command prompt, I ran Rainmeter.exe !RainmeterRefresh *, which worked successfully, and updated the meter to show the new image.

Note, I tried to copy all commands from this writeup to the command prompt, to try and ensure no undetectable typos, but it's possible I could have forgotten to do so with some.
User avatar
JamesAC
Developer
Posts: 318
Joined: July 14th, 2009, 5:57 pm

Re: Specifying a config in a bang (command line).

Post by JamesAC »

If you have a space in your config name, you should be able to enclose it in quotes to pass the whole thing as one argument
+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++
Quis custodiet ipsos custodes?
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Specifying a config in a bang (command line).

Post by jsmorley »

Try this:

"C:\Program Files\Rainmeter\Rainmeter.exe" !RainmeterRefresh "My Theme\Power Meter"

Seemed to work for me. Not sure why Rainmeter is being such a bitch about how quotes are used. The inconsistency of this is a long-standing frustration that we have not solved yet.

"C:\Program Files\Rainmeter\Rainmeter.exe" "!RainmeterRefresh" "My Theme\Power Meter" (Fails)
"C:\Program Files\Rainmeter\Rainmeter.exe" "!RainmeterRefresh My Theme\Power Meter" (Fails)
"C:\Program Files\Rainmeter\Rainmeter.exe !RainmeterRefresh My Theme\Power Meter" (Fails - But this is a Windows issue)
ZeroCool42
Posts: 4
Joined: September 25th, 2010, 11:54 am

Re: Specifying a config in a bang (command line).

Post by ZeroCool42 »

Ah, that works perfectly now! Brilliant! Thank you so much! :D