It is currently March 9th, 2021, 11:04 am

Nested(?) Variables

Help with creating, editing & fixing problems with skins
User avatar
redboot39
Posts: 4
Joined: February 19th, 2021, 4:09 pm

Nested(?) Variables

Post by redboot39 »

Hey y'all!
The purpose of this skin is to change #name# depending on an InputText measure, then send that text back to SlotNames.inc to be referenced by other skins. Eventually, SlotNames.inc will have 100 names, ranging from name1u1 to name10u10 (see snippet), so it would be great to automate this process with some fancy variable magic!

I would like to reference a variable (#name#) using other variables.
Essentially, #name# needs to change it's reference in SlotNames.inc depending on #rowNumber# and #columnNumber#. I would rather not hardcode the numbers since it would mean 100's of skins.
#currentGroupNumber#, #currentRowNumber#, and #currentColumnNumber# are from Variables.ini and work just fine.
Skin:

Code: Select all

[Variables]
@include = #@#Variables.ini
@include2 = #@#SlotFiles\Group#groupNumber#Variables\SlotNames.inc

groupNumber=#currentGroupNumber#
rowNumber=#currentRowNumber#
columnNumber=#currentColumnNumber#
name = #name#rowNumber#u#columnNumber##
;^line in question
SlotNames.inc:

Code: Select all

[Variables]
name1u1=redboot39
name1u2=lalala
name2u1=yoyoyo
name2u2=upupup
Does this make any sense whatsoever? lol
Last edited by balala on February 19th, 2021, 4:48 pm, edited 1 time in total.
Reason: Please use <code> tags, not <Snippet>, whenever are posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 12355
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested(?) Variables

Post by balala »

redboot39 wrote: February 19th, 2021, 4:34 pm Does this make any sense whatsoever? lol
Yes, it does. Try this variable (just take care to add a DynamicVariables=1 option to the measure or meter where you're using it): [#name[#rowNumber]u[#columnNumber]].
User avatar
redboot39
Posts: 4
Joined: February 19th, 2021, 4:09 pm

Re: Nested(?) Variables

Post by redboot39 »

Unfortunately that variable name just sets name = "[#name1u1]]" (ignore quotes).The same goes for when the last bracket is deleted.
What I think I can do is set a temporary variable called "tempName=" in SlotNames.inc and have that be a stepping-stone variable. If that doesn't work, I can try doing fancy InputText measure commands. Will update once I try these things!
User avatar
balala
Rainmeter Sage
Posts: 12355
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested(?) Variables

Post by balala »

redboot39 wrote: February 19th, 2021, 6:12 pm Unfortunately that variable name just sets name = "[#name1u1]]" (ignore quotes).The same goes for when the last bracket is deleted.
What I think I can do is set a temporary variable called "tempName=" in SlotNames.inc and have that be a stepping-stone variable. If that doesn't work, I can try doing fancy InputText measure commands. Will update once I try these things!
Since it seems the skin uses some included files (Variables.inc for instance) please pack the whole config and upload it, to can check. The posted nesting variable is working on my sample skin, it definitely should on your skin as well, but taking a look would be needed. Also please let me (us) know which skin have to load and what have to do, to see the result, which doesn't properly work.
User avatar
redboot39
Posts: 4
Joined: February 19th, 2021, 4:09 pm

Re: Nested(?) Variables

Post by redboot39 »

Can do! This is one of my first skins, and I wasn't sure where to start. So, I copied files from NUXHD (from DD-192 on DA). The skin is still very much in development and isn't fully realized yet. The goal is a configurable dock where the user can select a name, background color, sidebar color, and command for each button of a dock.
The file system is a little weird, but the important files are:
Load: Settings>SlotEditor.ini (Lines 14-15, 25, and 113-136)
Results: @Resources>SlotFiles>Group1Variables>SlotNames.inc (in code) and Settings>Group1.ini (visual)

To try it out, run load Settings>DockButtons. Click Group 1 (loads Group1.ini), and left-click the first "slot". Clicking the variable after "Name: " brings up InputText plugin and the correct variable in SlotNames.inc is changed. Clicking Ok accepts the change, cancel changes nothing.

Thank you for your help! Also, let me know if this is totally asinine and not worth the effort.
Honestly might just start over again from scratch, I didn't do enough planning beforehand.
You do not have the required permissions to view the files attached to this post.
User avatar
Active Colors
Moderator
Posts: 663
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Nested(?) Variables

Post by Active Colors »

name=[#name[#rowNumber]u[#columnNumber]]

Also this works but looks ugly:
name=[#name#rowNumber#u#columnNumber#]
User avatar
redboot39
Posts: 4
Joined: February 19th, 2021, 4:09 pm

Re: Nested(?) Variables

Post by redboot39 »

Ok Nevermind! Everything works now! I had defined #groupNumber# after including the files with that variable in them, essentially not including them at all. Not sure how I missed this the first time, but thanks to balala and Active Colors for the input! This is a great lesson on running through the code step-by step.
yesname.gif
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 12355
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested(?) Variables

Post by balala »

Active Colors wrote: February 19th, 2021, 7:05 pm name=[#name[#rowNumber]u[#columnNumber]]

Also this works but looks ugly:
name=[#name#rowNumber#u#columnNumber#]
Unfortunately I doubt it would be so simple.
redboot39 wrote: February 19th, 2021, 6:42 pm Can do! This is one of my first skins, and I wasn't sure where to start. So, I copied files from NUXHD (from DD-192 on DA). The skin is still very much in development and isn't fully realized yet. The goal is a configurable dock where the user can select a name, background color, sidebar color, and command for each button of a dock.
The file system is a little weird, but the important files are:
Load: Settings>SlotEditor.ini (Lines 14-15, 25, and 113-136)
Results: @Resources>SlotFiles>Group1Variables>SlotNames.inc (in code) and Settings>Group1.ini (visual)

To try it out, run load Settings>DockButtons. Click Group 1 (loads Group1.ini), and left-click the first "slot". Clicking the variable after "Name: " brings up InputText plugin and the correct variable in SlotNames.inc is changed. Clicking Ok accepts the change, cancel changes nothing.

Thank you for your help! Also, let me know if this is totally asinine and not worth the effort.
Honestly might just start over again from scratch, I didn't do enough planning beforehand.
Problem is that the groupNumber variable (which is added to the RedDock\@Resources\BaseSlotsGroup1.ini file) is not recognized. Probably an inclusion is missing somewhere, but it's hard for me to say where. If you add a @include10=#@#BaseSlotsGroup1.ini (or whatever number) to the [Variables] section of the RedDock\Settings\SlotEditor.ini file, you get the variable working well.
I probably would add the groupNumber variable to a distinct .inc file within the @Resources folder and would use it from there.
Note that it's not a good idea to include .ini files into your skin, because this kind of files can have (well, in fact in most cases they have) other codes than the variables as well and additionally they are seen by Rainmeter in list of skins (unless they are in the @Resources folder). The .inc files can't be seen in the list of skins and this is a big advantage in avoiding confusions.

EDIT: Sorry, missed your last reply. Glad if you got it working as intended.