It is currently December 8th, 2021, 7:38 pm

How to set variables in another config?

General topics related to Rainmeter.
vindurriel
Posts: 11
Joined: December 18th, 2009, 8:24 am

How to set variables in another config?

Post by vindurriel »

Seems !RainmeterSetVariable name value configName didn't work. The log file says "Unknown config name: "
I've tried for some time in vain, and it's better to ask before diving into something ugly.
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: How to set variables in another config?

Post by dragonmage »

I use NirCmd to do it. Put nircmd in Addons\NirCmd\ and you can use it for a lot of useful functions.
MattKing
Developer
Posts: 98
Joined: August 6th, 2009, 3:03 pm

Re: How to set variables in another config?

Post by MattKing »

You're probably not referencing the name of the config correctly.

When you right click on a skin and click on skin menu, the part at the top is what you must use as the name, the whole string with the slashes.


For example:
thing.png
vindurriel
Posts: 11
Joined: December 18th, 2009, 8:24 am

Re: How to set variables in another config?

Post by vindurriel »

MattKing wrote:You're probably not referencing the name of the config correctly.
When you right click on a skin and click on skin menu, the part at the top is what you must use as the name, the whole string with the slashes.
Sorry I've tried that.

Later I'll upload a demo using Nircmd, as Dragonmage suggested. Perhaps you could take a look and try the "RainmeterSetVariable" way out?
User avatar
jsmorley
Developer
Posts: 22421
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to set variables in another config?

Post by jsmorley »

Try the format:

!RainmeterSetVariable "FontColor" "0,0,0,255" "\Enigma\Sidebar\Clock"

Using quotes around all parameters.

Don't forget that any and all meters or measures which use this "set" variable must have DynamicVariables=1 set in them. (although that is not the problem you are seeing, it's worth pointing out.)
vindurriel
Posts: 11
Joined: December 18th, 2009, 8:24 am

Re: How to set variables in another config?

Post by vindurriel »

Still no luck.

The attachment is an rss reader prototype. What I wanna achieve is to use 5 sets of strings to display as many feed items as there are in the source page. For example, if now the strings display Item 1 to 5, after clicking "next", they show Item 6-10. Another "next", Item 11-15 ... till no more items. And button "prev" reverses the progress.

What I need "setVariable" to do is to keep a static index number which lasts between meter refreshes. SInce I couldn't make it work in that way, I used NirCmd instead.

Hope someone could instruct me how to use the setVariable way.
MattKing
Developer
Posts: 98
Joined: August 6th, 2009, 3:03 pm

Re: How to set variables in another config?

Post by MattKing »

I think I see the problem.

Right now with nircmd you're actually changing the value in the file.

With Rainmeter you're changing the value that is currently stored in memory. So when you use !RainmeterSetVariable it just changes what is in memory
and makes no permanent change to the variable (not writing to the file). So this means that when you use !RainmeterRefresh it reloads the value in the file that was originally there.

I would gather from what you posted you are using !RainmeterRefresh to get the WebParser measure to refresh and increase/decrease the string index.

The alternate solution is to use 5 more calc measures and use those to set the string indexes of the measures. (Formula=#n#+1, you see where I'm going with this). You'll also need to have DynamicVariables=1 on the measures. This instead of refreshing Webparser.

This brings up a good point though, perhaps a bang to force an update on a measure.
vindurriel
Posts: 11
Joined: December 18th, 2009, 8:24 am

Re: How to set variables in another config?

Post by vindurriel »

MattKing wrote:I think I see the problem.
This brings up a good point though, perhaps a bang to force an update on a measure.
That's a point we share.

However, I didn't get it when you say 5 more extra measures will solve the problem. Since the web parser doesn't re-parse the page by clicking (unless click invokes refresh), the reader displays 10 items top. What I wanted is to display all items on the page without necessarily knowing how many there are, which requires an iterator worked on web parser.
MattKing
Developer
Posts: 98
Joined: August 6th, 2009, 3:03 pm

Re: How to set variables in another config?

Post by MattKing »

vindurriel wrote: That's a point we share.

However, I didn't get it when you say 5 more extra measures will solve the problem. Since the web parser doesn't re-parse the page by clicking (unless click invokes refresh), the reader displays 10 items top. What I wanted is to display all items on the page without necessarily knowing how many there are, which requires an iterator worked on web parser.

Yeah I was just informed WebParser doesn't really behave like regular expressions normally do (to apparently prevent overflow). So I am at a loss here.

Though I can add a refresh bang just for a measure, as I see this being useful too.

I will try to implement this today but you will probably have to wait until the next beta to see it implemented. I suppose I could just send you the DLL if you needed it right now.

EDIT:

It seems I forgot something very important, Plugins can't use dynamic variables which makes all of this moot. This I find out after I've added that Bang.

The only solution I can see for this is to make your regular expression super long, like however many entries are in the RSS feed long. But I don't know how to do that.

The nircmd way of doing this is just much easier at this point.
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: How to set variables in another config?

Post by kenz0 »

DynamicVariables does not work on WebParser so RegExp in {#n#} does not change at all. In order to change Url, it must refresh, but the variable set when refreshed will be cleared.
After all, SetVariable is worthless for WebParser at least now.

So I suggest to you making an separate skin like 1-5.ini, 6-10.ini..., and switch them.
Although this is an old way, a code can be made slim by collecting the common portion of a code to @Include.
A reaction is not bad. I think that this is practical enough.

Anyway you can try this example.
rssReaper.zip
This one was only modified to your skin only a bit so keep in mind that this is not a completed example skin and is just hint.
.
Image