Using Toggle to work on 2 variants

Help with creating, editing & fixing problems with skins

Using Toggle to work on 2 variants

November 12th, 2017, 8:30 pm
JediWarrior
   [40 posts]

Hi Everyone, I'm working on a Control Panel/Launcher. There are 2 different variants of the Main Panel and 3 variants of another skin that I want to use as a Toggle for the Main Panel that is being used. The main part of my problem is I cant figure out how to write the code to put a variable in the @Resources Folder that can be read by the toggle skin to indicate which .ini to Toggle. I've probably made that as clear as mud as we are now in one of my post medication phases O.O O.O and what is a perfectly sensible question to me can look like the gibberings of a mad man to you :D :D If thats the case I'm sorry in advance if not....Well done Me :oops: :oops: I hope not @cus this is starting to annoy me nowand I hope 1 of you can help.....Thanks in Advance. P.S.I'm running RainMeter 4.1 with the latest update if thats of any relavance... :welcome: :welcome: :welcome: :thumbup: :thumbup: :thumbup:
User avatar

Re: Using Toggle to work on 2 variants

November 12th, 2017, 9:07 pm
balala
Rainmeter Sage   [4982 posts]

JediWarrior wrote:The main part of my problem is I cant figure out how to write the code to put a variable in the @Resources Folder that can be read by the toggle skin to indicate which .ini to Toggle.

You can't put a variable into a folder (nor in the @Resources, nor in any other). Instead you have to put that variable into a (usually) .inc file, which you have to include into all skins which have to use that variable.
Let me make it a bit clearer: let's say you have a MainSkin.ini skin file, within the MyConfig config. In the @Resources folder, add the Variables.inc file, with the following structure:

Code: Select all

[Variables]
MyVar=1

Any skin included into the MyConfig (or its subfolders) can use the MyVar variable, IF you add into its [Variables] section, the @Include=#@#Variables.inc option.
On the other hand, to write a new value for this variable, you have to use the following option: LeftMouseUpAction=[!WriteKeyValue Variables MyVar "THE-NEW-VALUE-OF-THE-VARIABLE" "#@#Variables.inc"]. See the last parameter of this option. It indicates the file where the variable will be writte (when you click the meter which has added this option).
The only disadvantage is that all skins which have to use the newly written value of the variable MUST be refreshed, otherwise they can't use the new value.
Please let me know if this is an acceptable practice for your needs, because if it's not, there are ways to use the new value of the variable, even without continuous refresh of the skin, but that's a bit more complicated.

Re: Using Toggle to work on 2 variants

November 14th, 2017, 9:40 pm
JediWarrior
   [40 posts]

Hi Balala, Thanks very much for your speedy reply and please let me apologise for the time it took for an acknowledgment to come your way. You should have seen this yesterday but I forgot to click "submit" :oops: :oops: :oops: . With regards to your answer, Again I'm sorry and should have explained myself better. I know that the variable must be in a .inc file and have done that part. I tried your solution but for some reason when I tried it and then went back to edit the toggle.ini it had had the amended variable written numerous times into the [Variables] Section. I'm beginning to think that I'm mainly making syntax errors in how I word the commands. I'm thinking this 'cus when I try to make a toggle specific to one panel so as to eliminate the need for a variable I still get back that the file to toggle is "Not Found" in the Manage Rainmeter Log so if I'm inputting!Toggle ControlPanel/controlpanelthen I must be wording it wrong. HELP...one last thing I wondered if I could use the !SetVariable bang instead and if I can, can I put it in the Rainmeter section of the .ini file that is setting the variable{i.e. The Control Panel} or does it have to be associated with a click? Again many for taking time out to help me and hopefully I'll be able to leave you in peace when I get this figured out.
:thumbup: :thumbup: :great: :great:
User avatar

Re: Using Toggle to work on 2 variants

November 15th, 2017, 1:46 pm
balala
Rainmeter Sage   [4982 posts]

JediWarrior wrote:I tried your solution but for some reason when I tried it and then went back to edit the toggle.ini it had had the amended variable written numerous times into the [Variables] Section. I'm beginning to think that I'm mainly making syntax errors in how I word the commands. I'm thinking this 'cus when I try to make a toggle specific to one panel so as to eliminate the need for a variable I still get back that the file to toggle is "Not Found" in the Manage Rainmeter Log so if I'm inputting!Toggle ControlPanel/controlpanelthen I must be wording it wrong.

Not sure what you mean by "written numerous times", because a variable will be written just once. If you want to use again the !WriteKeyValue bang to write a new value for the same variable, the already written value of the variable is replaced by the new value, usually you can't write it two or more times.
JediWarrior wrote:one last thing I wondered if I could use the !SetVariable bang instead and if I can, can I put it in the Rainmeter section of the .ini file that is setting the variable{i.e. The Control Panel} or does it have to be associated with a click? Again many for taking time out to help me and hopefully I'll be able to leave you in peace when I get this figured out.

!SetVariable sets dynamically the value of the variable and this value isn't written anywhere, which means that the skin after a refresh loses the value of that variable. If you write that value with a !WriteKeyValue bang, after refresh the skin is able to read the written value of the variable and can use it.
Many times we're using both bangs together: the !WriteKeyValue writes the value of the variable, but to avoid the needing of a refresh, we also set dynamically the same value of the variable, using a !SetVariable bang. This way the newly set value can be used even without a refresh, which is a destructive operation and at least me usually prefere to avoid it: viewtopic.php?p=119966#p119966

If you still have issues with your skin and can't figure out why the !WriteKeyValue bang doesn't want to write the appropriate value into the appropriate section, please post the code you have so far, to can take a look.

Re: Using Toggle to work on 2 variants

November 15th, 2017, 9:02 pm
JediWarrior
   [40 posts]

Hello Again Balala,
Thanks for that. I think I've figured out why it was writing to the wrong Section I think it was to do with the syntax. I think I misspelled in the Bang so it didnt recognise the path to write to so just wrote to the [Variables]Section of the .ini file the Bang was in and not to the Variables.inc file in @Resources :oops: :oops:
Hopefully this should set me on my way but thanks so much for the offer of checking the code for me [I may need to take you up on that yet :D ]Will hopefully be able to upload the skin soon, can't wait to see what people think. Its not much but its my first and all mine.
BTW. Balala it nice to speak to a fellow European. :welcome: :welcome: :thumbup: :thumbup: :D :D
User avatar

Re: Using Toggle to work on 2 variants

November 15th, 2017, 9:10 pm
balala
Rainmeter Sage   [4982 posts]

I'm glad if you got it working as you want. Post your work when it's ready, (I)we'll take a look.
And congratulations for your first (probably soon) completed skin. Have many more...

Return to “Help: Rainmeter Skins”



Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests