It is currently September 21st, 2020, 1:35 pm

[Feature Suggestion] !WriteVariable bang

Report bugs with the Rainmeter application and suggest features.
User avatar
deflore08
Posts: 38
Joined: July 12th, 2020, 7:47 am

[Feature Suggestion] !WriteVariable bang

Post by deflore08 »

As i know, Rainmeter have !SetVariable and !WriteKeyValue bangs.

In situations when we have to change a variable and remember new value, we using both bangs. I quess, Rainmeter knows the place (original file and and path to file) where used variable stores, so it would be convinient so Set and Write a value through 1 bang rather than 2. It would make code more short and nice, don't we? :)

Code: Select all

[!SetVariable VAR "Value"][!WriteKeyValue Variables VAR "Value" "#@#file.inc"]
VS

Code: Select all

[!WriteVariable VAR "Value"]
UPD:

Maybe for !SetOption is possible too?

Code: Select all

[!WriteOption Meter Option "Value"]
VS

Code: Select all

[!SetOption Meter Option "Value"][!WriteKeyValue Meter Option "Value" "#@#file.inc"]
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Feature Suggestion] !WriteVariable bang

Post by Yincognito »

deflore08 wrote: August 3rd, 2020, 11:29 pm As i know, Rainmeter have !SetVariable and !WriteKeyValue bangs.

In situations when we have to change a variable and remember new value, we using both bangs. I quess, Rainmeter knows the place (original file and and path to file) where used variable stores, so it would be convinient so Set and Write a value through 1 bang rather than 2. It would make code more short and nice, don't we? :)

Code: Select all

[!SetVariable VAR "Value"][!WriteKeyValue Variables VAR "Value" "#@#file.inc"]
VS

Code: Select all

[!WriteVariable VAR "Value"]
Yeah, while it may make the code shorter and be more comfortable to work with, it's really not about comfort here, but about functionality. The two bangs do different things: one writes the variable value to the memory, the other writes it to a file. One of Rainmeter's strengths is to "break up" an operation into "modular processes" that do just one thing only, so that the user can choose what part of the operation to do - a simple example is breaking up the whole update process of a meter into the "technical update", i.e. !UpdateMeter and the "visual update", i.e. !Redraw. This allows for greater flexibility (and clarity) in handling things, of course at the expense of comfort and options' length.

Personally, I don't see much value in having a !WriteVariable bang implemented, but then it's not my call to make and, of course, I could be wrong with this. I mean, it's not like we'd be able to break up long options or put bangs on separate lines anyway... :confused:

P.S. One can reduce the options' length by placing the bangs into variables as well. You can even place those variables on separate lines, like this (you'd have to remember the naming convention you use though, which might create an additional issue with debugging the skin a couple of months later, when you forgot what each "abbreviation" means):

Code: Select all

[Variables]
SV=[!SetVariable VAR "Value"]
WKV=[!WriteKeyValue Variables VAR "Value" "#@#file.inc"]
...
...
...
LeftMouseUpAction=#SV##WKV#
I used LeftMouseUpAction as an example, it could be any other "action" option there.
User avatar
deflore08
Posts: 38
Joined: July 12th, 2020, 7:47 am

Re: [Feature Suggestion] !WriteVariable bang

Post by deflore08 »

Yincognito wrote: August 4th, 2020, 10:46 am Yeah, while it may make the code shorter and be more comfortable to work with, it's really not about comfort here, but about functionality. The two bangs do different things: one writes the variable value to the memory, the other writes it to a file. One of Rainmeter's strengths is to "break up" an operation into "modular processes" that do just one thing only, so that the user can choose what part of the operation to do - a simple example is breaking up the whole update process of a meter into the "technical update", i.e. !UpdateMeter and the "visual update", i.e. !Redraw. This allows for greater flexibility (and clarity) in handling things, of course at the expense of comfort and options' length.

Personally, I don't see much value in having a !WriteVariable bang implemented, but then it's not my call to make and, of course, I could be wrong with this. I mean, it's not like we'd be able to break up long options or put bangs on separate lines anyway... :confused:

P.S. One can reduce the options' length by placing the bangs into variables as well. You can even place those variables on separate lines, like this (you'd have to remember the naming convention you use though, which might create an additional issue with debugging the skin a couple of months later, when you forgot what each "abbreviation" means):

Code: Select all

[Variables]
SV=[!SetVariable VAR "Value"]
WKV=[!WriteKeyValue Variables VAR "Value" "#@#file.inc"]
...
...
...
LeftMouseUpAction=#SV##WKV#
I used LeftMouseUpAction as an example, it could be any other "action" option there.
Yes, it's great that we can seperate !SetVariable and !WriteKeyValue. I just suggest to add a new bangs that unite these ones. So !SetVariable just change it, !WriteVariable changes + writes permanently. The same for !SetOption bang.

Using variables for mouse actions it is not bad choice, but it's not a perfect solution, i quess. ^))
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Feature Suggestion] !WriteVariable bang

Post by Yincognito »

deflore08 wrote: August 4th, 2020, 11:18 amUsing variables for mouse actions it is not bad choice, but it's not a perfect solution, i quess. ^))
Again, the mouse actions were used only as an example, it doesn't have to be about mouse actions. You can store any bangs in variables and use them wherever you like (or wherever the bangs themselves are allowed), not just in mouse actions.

It might not be the perfect solution, but it's an available one. ;-)
User avatar
deflore08
Posts: 38
Joined: July 12th, 2020, 7:47 am

Re: [Feature Suggestion] !WriteVariable bang

Post by deflore08 »

Yincognito wrote: August 4th, 2020, 11:27 am Again, the mouse actions were used only as an example, it doesn't have to be about mouse actions. You can store any bangs in variables and use them wherever you like (or wherever the bangs themselves are allowed), not just in mouse actions.

It might not be the perfect solution, but it's an available one. ;-)
Sure, i understand what do you talking about. Just it makes no different where we will write 100 lines of code, in a variables or in an options. But the first approach will make code more confiusing if we have, let's say.. 10-20 actions in each iteration and equal numbers of variables with it. :) Of course, it's good solution if we got to re-use these variables later more than 2 times. And as you said, maybe it is not perfect, but it's an available one. ))
User avatar
jsmorley
Developer
Posts: 21376
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Feature Suggestion] !WriteVariable bang

Post by jsmorley »

I'm not opposed in principle to !WriteVariable nor !WriteOption. While they don't provide any real new functionality, I think they might be a nice "quality of life" tweak for skin authors.

What likely won't be supported are !WriteVariableGroup or !WriteOptionGroup however. I think that might be a bridge too far for this.

Let us chew on this a bit.
User avatar
deflore08
Posts: 38
Joined: July 12th, 2020, 7:47 am

Re: [Feature Suggestion] !WriteVariable bang

Post by deflore08 »

Sure, it is not about new functionality, it is just to unite functionality of two bangs in short one to avoid the unreasonable code growth in some situations. Just another improvement.

No clues about Group-bangs.