It is currently April 19th, 2024, 7:08 pm

[Rebooted] Re: Can I extract the position of a skin to use as a variable?

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

[Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by Mor3bane »

Hi in reference to this thread: https://forum.rainmeter.net/viewtopic.php?f=5&t=28127

I am trying to implement this for my own purposing.

For that "mainconfig" the following is what I am hoping to use:

My difficulty is the config path e.g. I would like to actually reference a specific meter, rather than the whole config.

So to ask; how would that path look? Or do I simply name the [Meter]? There are two separate ini files in this case, so that is what I am getting snagged on. Otherwise, I think I get what is going on.

Thanks.

Code: Select all

[MeasureMainXY]
Measure=Calc
Formula=( #CURRENTCONFIGX# + #CURRENTCONFIGY# )
OnChangeAction=[!SetVariable X "#CURRENTCONFIGX#" "Round Arcane\Puzzles\Puzzle_1.ini"][!SetVariable Y "#CURRENTCONFIGY#" "Round Arcane\Puzzles" "Puzzle_1.ini"] [!Update "Round Arcane\Puzzles\Puzzle_1.ini"]
DynamicVariables=1
(Also, I really like SilverAzide's recommendation to use the !WriteKeyValue option rather than !SetVariable. Maybe we can talk about that as well?)
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by balala »

Mor3bane wrote:

Code: Select all

[MeasureMainXY]
Measure=Calc
Formula=( #CURRENTCONFIGX# + #CURRENTCONFIGY# )
OnChangeAction=[!SetVariable X "#CURRENTCONFIGX#" "Round Arcane\Puzzles\Puzzle_1.ini"][!SetVariable Y "#CURRENTCONFIGY#" "Round Arcane\Puzzles" "Puzzle_1.ini"] [!Update "Round Arcane\Puzzles\Puzzle_1.ini"]
DynamicVariables=1
As the last parameter of a !SetVariable bang, you have to add a config name, not a skin name. This means that both (differently written) !SetVariable bangs used above, are finally wrong. The same wrong is the !Update bang, which also requires a config, not a skin:
  • [!SetVariable X "#CURRENTCONFIGX#" "Round Arcane\Puzzles[color=#FF0000]\Puzzle_1.ini[/color]"]
  • [!SetVariable Y "#CURRENTCONFIGY#" "Round Arcane\Puzzles"[color=#FF0000] "Puzzle_1.ini"[/color]]
  • [!Update "Round Arcane\Puzzles[color=#FF0000]\Puzzle_1.ini[/color]"]
Mor3bane wrote:My difficulty is the config path e.g. I would like to actually reference a specific meter, rather than the whole config.
I'm not very sure I understood what you would like. You would like to to use the position of a meter of the current config (skin) into another skin, or you would like to use the position of the current skin, into a specific meter of the second skin (sorry about my not too good English)?
Mor3bane wrote:(Also, I really like SilverAzide's recommendation to use the !WriteKeyValue option rather than !SetVariable. Maybe we can talk about that as well?)
We can, however the !WriteKeyValue and the !SetVariable bangs are used for completely different operations: first writes physically a value of a variable (or of any other option) into a well defined section of the .ini file, while the second one sets just dynamically a variable, without writing it to a file. Which operation is better to be used, depends on the concrete needs.
A very important difference of these two bangs is that the value of a variable set up with a !SetVariable bang can be immediately used (just take care to not forget the DynamicVariables=1 option), while to use a value written by a !WriteKeyValue bang, the skin has to be refreshed.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by Mor3bane »

balala wrote:As the last parameter of a !SetVariable bang, you have to add a config name, not a skin name. This means that both (differently written) !SetVariable bangs used above, are finally wrong. The same wrong is the !Update bang, which also requires a config, not a skin:
  • [!SetVariable X "#CURRENTCONFIGX#" "Round Arcane\Puzzles[color=#FF0000]\Puzzle_1.ini[/color]"]
  • [!SetVariable Y "#CURRENTCONFIGY#" "Round Arcane\Puzzles"[color=#FF0000] "Puzzle_1.ini"[/color]]
  • [!Update "Round Arcane\Puzzles[color=#FF0000]\Puzzle_1.ini[/color]"]
I am a bit fuzzy on the definition of "config" in this context. Is that referencing a meter under the path and NOT the .ini as you indicated with the red colour?
balala wrote:I'm not very sure I understood what you would like. You would like to to use the position of a meter of the current config (skin) into another skin, or you would like to use the position of the current skin, into a specific meter of the second skin (sorry about my not too good English)?
I would like the position of the current "main"/parent skin to determine the position of the specific meter of the second skin.
balala wrote:We can, however the !WriteKeyValue and the !SetVariable bangs are used for completely different operations: first writes physically a value of a variable (or of any other option) into a well defined section of the .ini file, while the second one sets just dynamically a variable, without writing it to a file. Which operation is better to be used, depends on the concrete needs.
A very important difference of these two bangs is that the value of a variable set up with a !SetVariable bang can be immediately used (just take care to not forget the DynamicVariables=1 option), while to use a value written by a !WriteKeyValue bang, the skin has to be refreshed.
I think I will stick to !SetVariable, since it seems to involve less rewriting of that variable should movement be frequent.

So I understand that my syntax is wrong, but still not seeing clearly how the "config" reference works if it is used correctly.

What kind of example would demonstrate for me given my intention in the second reply here?
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by Mor3bane »

Once I figure this out, and I get that understanding I am looking for (thanks balala, for pitching in with this), there is going to be a boatload of this kind of code all over the shop.

I can't wait to understand this concept! :17readbook
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by balala »

Mor3bane wrote:I am a bit fuzzy on the definition of "config" in this context. Is that referencing a meter under the path and NOT the .ini as you indicated with the red colour?
The Config is the path of the folder which contains the .ini file, starting from the Skins folder. Eg, if your skin file is Skins\Round Arcane\Puzzles\Puzzle_1.ini, then the config is Round Arcane\Puzzles. Details: https://docs.rainmeter.net/manual/skins/#Config
Mor3bane wrote:I would like the position of the current "main"/parent skin to determine the position of the specific meter of the second skin.
Then replace the !SetVariable bangs of the OnChangeAction option of the [MeasureMainXY] measure with something like it follows:

Code: Select all

[MeasureMainXY]
Measure=Calc
Formula=( #CURRENTCONFIGX# + #CURRENTCONFIGY# )
OnChangeAction=[!SetOption MovingMeter X "#CURRENTCONFIGX#" "Round Arcane\Puzzles"][!SetOption MovingMeter Y "#CURRENTCONFIGY#" "Round Arcane\Puzzles"][!UpdateMeter "Round Arcane\Puzzles"][!Redraw "Round Arcane\Puzzles"]
DynamicVariables=1
To be honest a such operation (moving a meter based on the position of a skin), is weird, but finally it's not impossible. Just take care to replace the second parameter of the above !SetOption bangs, with the name of the meter you'd like to move.
Mor3bane wrote:I think I will stick to !SetVariable, since it seems to involve less rewriting of that variable should movement be frequent.
What solution do you choose, it's entirely up to you, or more precisely, up to what you'd like to achieve.
Mor3bane wrote:So I understand that my syntax is wrong, but still not seeing clearly how the "config" reference works if it is used correctly.
Since at a moment, one single skin can be loaded from a config (folder), we're not referring to the loaded skin, but to the config (folder) which contains the loaded skin. It's so simple.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by jsmorley »

One way to look at this:

When Rainmeter is dealing with a skin in "memory", when you are asking Rainmeter to do something to a loaded and running skin, it is referred to by the config name. At that point, Rainmeter doesn't know or care which particular skin .ini file is loaded. Since only one .ini at a time in a single config folder can be loaded at once, it's not important. Again, Rainmeter literally doesn't know which .ini file is currently loaded, and it doesn't care. It's acting on whatever skin is currently loaded from that config folder, and it is all happening in memory.

If you are doing something with a skin's physical "file", the actual skin .ini file, then you need the name of the file. This will be in only two instances.

1) When using !ActivateConfig or !ToggleConfig to load a physical file from disk into Rainmeter.
2) When Using !WriteKeyValue to physically write something to a skin file
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by balala »

jsmorley wrote:1) When using !ActivateConfig to load a physical file from disk into Rainmeter.
Or the !ToggleConfig bang...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by jsmorley »

balala wrote:Or the !ToggleConfig bang...
Right. I knew I'd miss one.
User avatar
balala
Rainmeter Sage
Posts: 16145
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by balala »

jsmorley wrote:Right. I knew I'd miss one.
Doesn't matter too much. !ToggleConfig is very less used, I think.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [Rebooted] Re: Can I extract the position of a skin to use as a variable?

Post by Mor3bane »

jsmorley wrote:One way to look at this:

When Rainmeter is dealing with a skin in "memory", when you are asking Rainmeter to do something to a loaded and running skin, it is referred to by the config name. At that point, Rainmeter doesn't know or care which particular skin .ini file is loaded. Since only one .ini at a time in a single config folder can be loaded at once, it's not important. Again, Rainmeter literally doesn't know which .ini file is currently loaded, and it doesn't care. It's acting on whatever skin is currently loaded from that config folder, and it is all happening in memory.

If you are doing something with a skin's physical "file", the actual skin .ini file, then you need the name of the file. This will be in only two instances.

1) When using !ActivateConfig or !ToggleConfig to load a physical file from disk into Rainmeter.
2) When Using !WriteKeyValue to physically write something to a skin file
Perfect explanation! Thanks jsmorley.
jsmorley wrote: Right. I knew I'd miss one.
balala wrote:Doesn't matter too much. !ToggleConfig is very less used, I think.
I do actually use that one :)
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.