It is currently March 29th, 2024, 5:27 am

Best way to use MeasureNames efficiently for a skin with lots of string meters?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Best way to use MeasureNames efficiently for a skin with lots of string meters?

Post by Yincognito »

MattNY177 wrote: April 5th, 2019, 11:39 amThis is based on your original suggestion to add OnUpdateAction=[!SetVariable #ParentName# #CURRENTSECTION#] to all parent Tiles, then OnUpdateAction=[!CommandMeasure Measure_WebParser "Run"] to each child meter.
If you read my original suggestion again you will see that I never mentioned an OnUpdateAction=[!CommandMeasure Measure_WebParser "Run"], probably because you explained what the process is about (and the fact that there are WebParser measures involved) only later on. When I was aware of these details, I recommended a sequential approach.

NOTE: I think you meant [!CommandMeasure Measure_WebParser "Update"] and not [!CommandMeasure Measure_WebParser "Run"], as per the manual.
MattNY177 wrote: April 5th, 2019, 11:39 amIn this scenario, doesn't it seem like there would be many overlapping commands being sent to each measure? If what you say is true, then only the last command would actually resolve rendering all the previous ones cancelled before completion, is that correct?

If so, it sounds like the only solution is to create multiple measures to perform the same function (#1 above). I just want to clarify this is the case before I pursue that option.
No. If what I said is right, the last command will be the only one actually executed, because it overrided / cancelled all the commands before it. Yes, there will be a lot of overlap judging from your process description. The solutions are:
- do the thing sequentially, using a single WebParser measure
- create multiple WebParser measures to perform the same function (#1 above)
The latter seems to be your preferred solution so you might as well give it a shot.

The best way to clarify things in this case is for you to try the approach. It doesn't have to be in the original skin, you can always copy-paste the relevant steps to a simple sample skin with just 2 or 3 tiles/children and see how it works using the Rainmeter log. It doesn't have to have all the styles, the variables or the measures/meters of the original skin, just the basics. If you're then happy with how it works, you can easily implement things back in your original (and more complex) skin.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Best way to use MeasureNames efficiently for a skin with lots of string meters?

Post by Yincognito »

Here is a simple test skin based on the things you already mentioned about the process (I used variable in some cases where it wasn't relevant to use other calculations/plugins/etc. - for example in the [TileNNN_Name_string] measures, or tile visibility):

Code: Select all

[Variables]
ParentName=""
Tile001_isVisible=0
Tile002_isVisible=0
Tile003_isVisible=0
Tile001_Background_color=255,0,0,255
Tile002_Background_color=0,255,0,255
Tile003_Background_color=0,0,255,255
Tile001_URL="https://newevolutiondesigns.com/images/freebies/car-wallpaper-preview-1.jpg"
Tile002_URL="https://newevolutiondesigns.com/images/freebies/car-wallpaper-preview-2.jpg"
Tile003_URL="https://newevolutiondesigns.com/images/freebies/car-wallpaper-preview-3.jpg"

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Measures---

[ParentName]
Measure=String
String=
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(.{7}).*$":"\1"
OnUpdateAction=[!SetVariable ParentName [ParentName]]

[Tile001_Name_string]
Measure=String
String=Tile 1
UpdateDivider=-1
DynamicVariables=1

[Tile001_Thumbnail_image]
Measure=WebParser
FinishAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!UpdateMeterGroup "[ParentName]"][!RedrawGroup "[ParentName]"]
Download=1
UpdateRate=3600
DynamicVariables=1

[Tile002_Name_string]
Measure=String
String=Tile 2
UpdateDivider=-1
DynamicVariables=1

[Tile002_Thumbnail_image]
Measure=WebParser
FinishAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!UpdateMeterGroup "[ParentName]"][!RedrawGroup "[ParentName]"]
Download=1
UpdateRate=3600
DynamicVariables=1

[Tile003_Name_string]
Measure=String
String=Tile 3
UpdateDivider=-1
DynamicVariables=1

[Tile003_Thumbnail_image]
Measure=WebParser
FinishAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!UpdateMeterGroup "[ParentName]"][!RedrawGroup "[ParentName]"]
Download=1
UpdateRate=3600
DynamicVariables=1

---Meters---

[Tile001]
Hidden=#CURRENTSECTION#_isVisible
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color 0,0,0,255 | StrokeWidth 0
X=0
Y=0
UpdateDivider=-1
OnUpdateAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!SetOption #CURRENTSECTION#_Thumbnail_image URL "[#[#CURRENTSECTION]_URL]"][!CommandMeasure #CURRENTSECTION#_Thumbnail_image "Update"]
DynamicVariables=1

[Tile001_Background]
Group=[ParentName]
Container=[ParentName]
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color [#[&ParentName]_Background_color] | StrokeWidth 0
X=0
Y=0
UpdateDivider=-1
DynamicVariables=1

[Tile001_Thumbnail]
Group=[ParentName]
Container=[ParentName]
Meter=Image
X=5
Y=5
W=40
H=40
MeasureName=[ParentName]_Thumbnail_image
UpdateDivider=-1
DynamicVariables=1

[Tile001_Name]
Group=[ParentName]
Container=[ParentName]
Meter=String
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=CenterCenter
X=25
Y=25
MeasureName=[ParentName]_Name_string
UpdateDivider=-1
DynamicVariables=1

[Tile002]
Hidden=#CURRENTSECTION#_isVisible
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color 0,0,0,255 | StrokeWidth 0
X=50
Y=0
UpdateDivider=-1
OnUpdateAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!SetOption #CURRENTSECTION#_Thumbnail_image URL "[#[#CURRENTSECTION]_URL]"][!CommandMeasure #CURRENTSECTION#_Thumbnail_image "Update"]
DynamicVariables=1

[Tile002_Background]
Group=[ParentName]
Container=[ParentName]
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color [#[&ParentName]_Background_color] | StrokeWidth 0
X=0
Y=0
UpdateDivider=-1
DynamicVariables=1

[Tile002_Thumbnail]
Group=[ParentName]
Container=[ParentName]
Meter=Image
X=5
Y=5
W=40
H=40
MeasureName=[ParentName]_Thumbnail_image
UpdateDivider=-1
DynamicVariables=1

[Tile002_Name]
Group=[ParentName]
Container=[ParentName]
Meter=String
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=CenterCenter
X=25
Y=25
MeasureName=[ParentName]_Name_string
UpdateDivider=-1
DynamicVariables=1

[Tile003]
Hidden=#CURRENTSECTION#_isVisible
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color 0,0,0,255 | StrokeWidth 0
X=100
Y=0
UpdateDivider=-1
OnUpdateAction=[!SetOption ParentName String "#CURRENTSECTION#"][!UpdateMeasure "ParentName"][!SetOption #CURRENTSECTION#_Thumbnail_image URL "[#[#CURRENTSECTION]_URL]"][!CommandMeasure #CURRENTSECTION#_Thumbnail_image "Update"]
DynamicVariables=1

[Tile003_Background]
Group=[ParentName]
Container=[ParentName]
Meter=Shape
Shape=Rectangle 0,0,50,50 | Fill Color [#[&ParentName]_Background_color] | StrokeWidth 0
X=0
Y=0
UpdateDivider=-1
DynamicVariables=1

[Tile003_Thumbnail]
Group=[ParentName]
Container=[ParentName]
Meter=Image
X=5
Y=5
W=40
H=40
MeasureName=[ParentName]_Thumbnail_image
UpdateDivider=-1
DynamicVariables=1

[Tile003_Name]
Group=[ParentName]
Container=[ParentName]
Meter=String
FontSize=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=CenterCenter
X=25
Y=25
MeasureName=[ParentName]_Name_string
UpdateDivider=-1
DynamicVariables=1
I ditched the variable approach in favor of the string measure approach (one of the solutions I proposed a couple of replies back), since there are some issues when using a modified variable on the same row of bangs where it was modified (it retains the old value, not the new one). The #ParentName# variable is created anyway in the OnUpdateAction of the [ParentName] measure, in case you prefer to use it.

The [ParentName] measure is updated both in [TileNNN] and in the FinishAction of the WebParser measures, so there isn't any mismatch and the parent name is always the current one, depending on the measure or meter currently running. All the things are only updated on demand (UpdateDivider=-1 option), to minimize the risk of things updating "behing my back" and messing up values and such.

Adapt and develop this according to your needs. The site I used as for testing was 20 HD Car Wallpapers.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
MattNY177
Posts: 28
Joined: December 3rd, 2018, 1:15 am

Re: Best way to use MeasureNames efficiently for a skin with lots of string meters?

Post by MattNY177 »

Yincognito wrote: April 5th, 2019, 11:16 pm Adapt and develop this according to your needs. The site I used as for testing was 20 HD Car Wallpapers.
Very cool of you to do this, much appreciated. I had to take a break from this project for the past couple days, but I'll experiment with these suggestions and see what works.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Best way to use MeasureNames efficiently for a skin with lots of string meters?

Post by Yincognito »

MattNY177 wrote: April 9th, 2019, 4:26 am Very cool of you to do this, much appreciated. I had to take a break from this project for the past couple days, but I'll experiment with these suggestions and see what works.
Ok then - good luck with it. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth