It is currently March 28th, 2024, 3:53 pm

Reading from Rainmeter.ini or other .ini

Get help with creating, editing & fixing problems with skins
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Reading from Rainmeter.ini or other .ini

Post by Codger »

balala wrote:Ok, please pack your config and upload it. It would be the simplest solution to can check what you have. If you agree, be careful to include all configs, if more then one are needed.
Forgive my ignorance. I'm not sure I understand the request. The skin is currently just the code posted. And the common.inc listed in the opening post. And the .lua file you wrote. Am I misunderstanding what you need?

Do you want those three things packed up and attached and if so do you have a preferred container?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Reading from Rainmeter.ini or other .ini

Post by eclectic-tech »

Codger wrote:Forgive my ignorance. I'm not sure I understand the request. The skin is currently just the code posted. And the common.inc listed in the opening post. And the .lua file you wrote. Am I misunderstanding what you need?

Do you want those three things packed up and attached and if so do you have a preferred container?
Yes, create a rmskin package using the button in the !Manage dialog. Include the topmost folder for this project and attach that file to a post here.

This is needed because you have multiple included files, in multiple locations (all that must be correctly placed and named) or it will not work.

Aside: In a number of places in your code you appear to be trying to set a variable value using "keyword = value" syntax, that will NOR work. you need to use !SetVariable and to permanently change the value, !WriteKeyValue in an action bang, such as OnUpdateAction=[!SetVariable LastX #MasterX#][!SetVariable LastY #MasterY#]

Suggestion:
It is much easier for people to help if you do not have multiple include files while troubleshooting skins. Put all of the code in one file (less LUA scripts), then after the skin is working, separate them out into included files to add the versatility you want.
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Reading from Rainmeter.ini or other .ini

Post by Codger »

eclectic-tech wrote: Aside: In a number of places in your code you appear to be trying to set a variable value using "keyword = value" syntax, that will NOR work. you need to use !SetVariable and to permanently change the value, !WriteKeyValue in an action bang, such as OnUpdateAction=[!SetVariable LastX #MasterX#][!SetVariable LastY #MasterY#]
Today the tumors have consented today to leaving me a focused sharp mind. So I am going to take this new/old knowledge you provide above (thank you for pointing out the "do it" command I asked about) plus whatever I can glean from the slightly more complex skins you fine people helped me write in Thailand and attack this problem myself.

If I ask questions it will be with small snippets or of the "how do I?" variety.

It becomes clear to me, as it certainly has sadly several times along this road, that the meters and measures don't execute so much as exist. You can order the lines within each for the most part in nearly any order and it would function the same. And from that springs all the differences that stifle the way I am used to doing things. But slowly 12 steps (forward, eleven back.)

Wish me luck today. Hopefully the world won't interrupt me.

Again thank you for your time and patience. I know it must seem an odd item for a bucket list, but I will conquer - to my satisfaction - this language.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reading from Rainmeter.ini or other .ini

Post by balala »

eclectic-tech wrote:Aside: In a number of places in your code you appear to be trying to set a variable value using "keyword = value" syntax, that will NOR work. you need to use !SetVariable and to permanently change the value, !WriteKeyValue in an action bang, such as OnUpdateAction=[!SetVariable LastX #MasterX#][!SetVariable LastY #MasterY#]
Something similar I said before:
balala wrote:
  • What the [SetRackTop] section of the main code, want to be? It's not a measure, it's not a meter, so what you wanted to achieve with it? In Rainmeter, such sections can't be used. The options posted under it, are "orphans".
However I didn't realize that those options wanted to be some variables settings. Now suddenly became clear to me what Codger wanted to achieve.
So, if you're right eclectic-tech, probably the [SetRackTop] section should be a measure, something like:

Code: Select all

[SetRackTop]
Measure=Calc
OnUpdateAction=[!SetVariable LastX "#MasterX#"][!SetVariable LastY "#MasterY#"][!SetVariable MasterX "(#CURRENTCONFIGX#+10)"][!SetVariable MasterY "#CURRENTCONFIGY#"]
DynamicVariables=1
UpdateDivider=-1
or eventually:

Code: Select all

[SetRackTop]
Measure=Calc
OnUpdateAction=[!SetVariable LastX "#MasterX#"][!SetVariable LastY "#MasterY#"][!SetVariable MasterX "(#CURRENTCONFIGX#+10)"][!SetVariable MasterY "#CURRENTCONFIGY#"][!WriteKeyValue Variables LastX "#MasterX#"][!WriteKeyValue Variables LastY "#MasterY#"][!WriteKeyValue Variables MasterX "(#CURRENTCONFIGX#+10)"][!WriteKeyValue Variables MasterY "#CURRENTCONFIGY#"]
DynamicVariables=1
UpdateDivider=-1
The first variant will set dynamically the LastX, LastY, MasterX and MasterY variable, without writing them to the [Variables] section, while the second one, besides setting them dynamically will also write them to the [Variables] section, making this way the skin to keep them, even after a refresh.
Same thing about the #MasterY# = (#MasterY# + 58) option of the [MeasureSetBottomHardDriveUsageBarCInRack] measure, which probably should be: OnUpdateAction=[!SetVariable #MasterY# "(#MasterY# + 58)"] or OnUpdateAction=[!SetVariable #MasterY# "(#MasterY# + 58)"][!WriteKeyValue Variables #MasterY# "(#MasterY# + 58)"]
Just be careful to add a DynamicVariables=1 option to each meter or/and measure, which will have to use the dynamically set variables, otherwise they won't see them.
Codger wrote:Forgive my ignorance. I'm not sure I understand the request. The skin is currently just the code posted. And the common.inc listed in the opening post. And the .lua file you wrote. Am I misunderstanding what you need?

Do you want those three things packed up and attached and if so do you have a preferred container?
I have the (maybe wrong?) impression, that there are needed more then just three files: the Config containing the skin(s) belonging to the RackMaster group (with all its content) would be also needed, if those files are not included into the "main" config. If this is true and those files indeed are contained into another config, creating the .rmskin (as eclectic-tech has described) won't be possible, because you can't include two (or more) configs, into one single .rmskin. In this case, simply zip them and upload the package. Be careful to pack all included files, such as Common.inc, HardDriveBar.inc, or ReadIni.lua (even if this last one has exactly the posted code) and so on. Everything contained into the appropriate configs (folders).
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Reading from Rainmeter.ini or other .ini

Post by Codger »

balala wrote:I have the (maybe wrong?) impression, that there are needed more then just three files: the Config containing the skin(s) belonging to the RackMaster group (with all its content) would be also needed, if those files are not included into the "main" config.
Having you run it was jumping the gun. It was just a very lazy approach on my part. I'd rather tackle it bit by bit.

I suspect I have misconceptions with groups but that is a problem for a little bit further down the road. The manual is to my mind rather skimpy on info on groups. A full example in each main category would be extremely useful. Or at least one overall.

[hr][/hr]
I can't believe the errors and confusions I found as I dug this widget apart. I must have been much foggier than I thought. The foggier you get the harder it is to judge how foggy you are sadly.

Anyway stripping away all the garbage and support for later stages we get this core:

Code: Select all

[DidRackMove]
Measure=String
IfCondition=(#LastX# = #CURRENTCONFIGX#) && (#LastY# = #CURRENTCONFIGY#)
IfFalseAction=[!UpdateMeasure SetRackTop][!refreshgroup RackMaster]
DynamicVariables=1

[SetRackTop]
Measure=String
OnUpdateAction=[!SetVariable LastX #MasterX#][!SetVariable LastY #MasterY#][!SetVariable MasterX (#CURRENTCONFIGX#+10)][!SetVariable MasterY  #CURRENTCONFIGY#]
DynamicVariables=1
UpdateDivider=-1
DidRackMove will be the only constantly cycling object (meter/measure) in the skin. Everything else will set in motion from that IfFalseAction statement. All other objects will end in: UpdateDivider=-1

Currently according to the log I have a syntax on the IfCondition line.

Aside: Why does the log not have a context menu with a copy command so you could easily share a log item?
Try as I might I can not find a syntax error in that line. Is it staring me in the face?

Hmmm, another look at the log variables shows 'lastx is set to #CURRENTCONFIGX#' which matches with the wording of the syntax error. It appears to be not resolving #CURRENTCONFIGX# in both the IfCondition and the !SetVariable statements. What am I not knowing?

Thanks
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Reading from Rainmeter.ini or other .ini

Post by Codger »

I stripped it down to the smallest self-contained runnable unit.
This does nothing more than create a tiny little gray button with a snowflake in it that can be dragged around the screen.
But if you look at the very few variables in the log something very wrong is happening.

Somehow
LastX = #CURRENTCONFIGX#
LastY = #CURRENTCONFIGY#

in the Variables section is being taken literally. Which then ripples through everything as an error in IfCondition and LastY being assigned the text #CURRENTCONFIGY#. And damned if I know what I'm missing.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
MiddleMouseDownAction=!RainmeterDeactivateConfig

[Metadata]
Name=RackMaster3
Author=Codger
Information=
Version=0.0.1
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
MediumGrey=25,25,25
PureYellow=255,255,0
CRadius=7
CBorder=4

;the current insertion point for the next item on the rack
MasterX = #CURRENTCONFIGX#
MasterY = #CURRENTCONFIGY#
;the last screen position of the tug skin (this skin)
LastX = #CURRENTCONFIGX#
LastY = #CURRENTCONFIGY#

[Background]
Meter=Shape
X=(#CRadius#+2)
Y=(#CRadius#+2)
Shape=Rectangle X,Y,(#CRadius#*3),(#CRadius#*4),10 | Extend MyModifiers1
MyModifiers1=Fill Color #MediumGrey#,160 | StrokeWidth #CBorder# | Stroke Color #MediumGrey#,222
UpdateDivider=-1

[RackSymbol]
Meter=String
X=(#CRadius#+4)
Y=(#CRadius#+5)
FontFace=WingDings
FontColor=#PureYellow#,240
FontSize=(#CRadius#*2+1)
StringStyle = Bold
Text=T
;❄︎
UpdateDivider=-1

[SetRackTop]
Measure=String
OnUpdateAction=[!SetVariable LastX #MasterX#][!SetVariable LastY #MasterY#][!SetVariable MasterX (#CURRENTCONFIGX#+10)][!SetVariable MasterY  #CURRENTCONFIGY#]
DynamicVariables=1
UpdateDivider=-1

[DidRackMove]
Measure=String
IfCondition=(#LastX# = #CURRENTCONFIGX#) && (#LastY# = #CURRENTCONFIGY#)
IfFalseAction=[!UpdateMeasure SetRackTop][!refreshgroup RackMaster]
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reading from Rainmeter.ini or other .ini

Post by balala »

Codger wrote:Somehow
LastX = #CURRENTCONFIGX#
LastY = #CURRENTCONFIGY#

in the Variables section is being taken literally. Which then ripples through everything as an error in IfCondition and LastY being assigned the text #CURRENTCONFIGY#. And damned if I know what I'm missing.
This is happening because the [Variables] section doesn't support dynamic variables, which would be needed for such attribution. The MasterX and MasterY get their values through the OnUpdateAction option of the [SetRackTop] measure, not through the direct attributions in the [Variables] section. The only option which sets the LastX and LastY variables is the same OnUpdateAction option of the [SetRackTop] measure. But they are not set correctly, because the bangs of that option are executed simultaneously, which means that MasterX and MasterY didn't get their values yet, when these values already should be attributed to LastX and LastY.
The simplest solution would be to disable the [DidRackMove] measure (which has the incriminated IfCondition option), adding a Disabled=1 option, remove the attribution of the LastX, LastY, MasterX and MasterY variables from the [Variables] section, then attribute the needed values to those variable through an OnRefreshAction option, added to the [Rainmeter] section. This option should also enable the [DidRackMove] measure: OnRefreshAction=[!SetVariable LastX "#CURRENTCONFIGX#"][!SetVariable LastY "#CURRENTCONFIGY#"][!EnableMeasure "DidRackMove"]. I think this will remove the error messages.
User avatar
Codger
Posts: 97
Joined: May 29th, 2017, 3:16 pm

Re: Reading from Rainmeter.ini or other .ini

Post by Codger »

balala wrote:This is happening because the [Variables] section doesn't support dynamic variables, which would be needed for such attribution. The MasterX and MasterY get their values through the OnUpdateAction option of the [SetRackTop] measure, not through the direct attributions in the [Variables] section. The only option which sets the LastX and LastY variables is the same OnUpdateAction option of the [SetRackTop] measure. But they are not set correctly, because the bangs of that option are executed simultaneously, which means that MasterX and MasterY didn't get their values yet, when these values already should be attributed to LastX and LastY.
The simplest solution would be to disable the [DidRackMove] measure (which has the incriminated IfCondition option), adding a Disabled=1 option, remove the attribution of the LastX, LastY, MasterX and MasterY variables from the [Variables] section, then attribute the needed values to those variable through an OnRefreshAction option, added to the [Rainmeter] section. This option should also enable the [DidRackMove] measure: OnRefreshAction=[!SetVariable LastX "#CURRENTCONFIGX#"][!SetVariable LastY "#CURRENTCONFIGY#"][!EnableMeasure "DidRackMove"]. I think this will remove the error messages.
Wait. So the one section that is guaranteed to run only once and run first can't have a static version of a built-in dynamic variable? Anywhere else that makes sense but why on earth in Variables?

And not even a string of bangs operate top-down? So you have to create a series of artificial dykes and valves to create any form of sequencing?

That hurts my brain and is ceasing to be fun. Too alien. I thank you for your time, effort and help but I think I'm going to wrap up my affairs here and return to paradise.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reading from Rainmeter.ini or other .ini

Post by balala »

Codger wrote:Wait. So the one section that is guaranteed to run only once and run first can't have a static version of a built-in dynamic variable? Anywhere else that makes sense but why on earth in Variables?
As I said, they are not working in the [Variables] section because they could work only if the section where they are used / set, supports the dynamic variables (even if they are set directly, as they are in the [Variables] section). But the [Variables] section doesn't support this.
Codger wrote:And not even a string of bangs operate top-down? So you have to create a series of artificial dykes and valves to create any form of sequencing?
It seems that all bangs of an option are executed simultaneously. So, for example the LeftMouseUpAction=[!SetVariable MyVar2 "#MyVar#"][!SetVariable MyVar3 "#MyVar2#"] option, if the MyVar variable is properly set in the [Variables] section, will give to MyVar2 the proper value, but MyVar3 won't be set. It wont be, even if the bang used to set it is placed after that used to set up MyVar2. This because the two bangs being executed simultaneously, when the meter is clicked, the MyVar2 doesn't have yet a value, which could be get by MyVar3.
Post Reply