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

OnRefreshAction

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

OnRefreshAction

Post by sl23 »

I've just been making a new suite and found out about the @include option! That saves so much time and hassle copying and pasting to each skin! Excellent.

Anyway, my issue...

I wanted to put the contents sections of my skins into the @include file, but I need to set the text colour and remove a meter style depending which skin is loaded.

Basically, all the skins are identical with a content list on left. Click an item to show it's content on the right.
The left Contents should be highlighted depending which is loaded.

This is what I want to put into the @include file:

Code: Select all

========================================
; Contents
========================================
[Apps]
Meter=String
MeterStyle=sAllText | sContents | sHighlight
X=20
Y=35

[Devices]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Display]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Edit]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Internet]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Location]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Media]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Navigation]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Office]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[People]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Power]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Status]
Meter=String
MeterStyle=sAllText | sContents | sHighlight

[Template]
Meter=String
MeterStyle=sAllText | sContents
FontColor=#Color4#
In this example I want the last entry coloured as you can see. But when I add it to @include, I need to remove the FontColor=#Color4# and set this in the specific skin file.

Also, you can see that this last entry has MeterStyle=sAllText | sContents but again, this needs to be set to this per skin file and the full MeterStyle=sAllText | sContents | sHighlight in the @include file.

I tried this, but I don't think you can use Variables in the Rainmeter section?

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
MouseActionCursor=0
@include=#@#Meters.inc
OnRefreshAction=[!SetOption #Title# Color #Color4#][!SetOption #Title# MeterStyle "sAllText | sContents"]
Sorry if that doesn't make much sense! :oops:
Last edited by sl23 on August 30th, 2021, 7:03 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: OnRefreshAction

Post by balala »

sl23 wrote: August 30th, 2021, 12:01 pm I tried this, but I don't think you can use Variables in the Rainmeter section?
You can use variables in the [Rainmeter] section, but you can't modify them dynamically. In fact the [Rainmeter] section is not dynamic at all, which means you can't modify it neither with !SetOption, nor with !SetVariable bangs, excepting the custom Context menu items (see the first Note here).
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

Thanks balala, I'd just read about it! :D
Is there any other way to achieve the same result?
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

Ok, so I'm trying a different approach...
On selecting, ie left clicking, a Content title it sets the options as this...

Code: Select all

[sContents]
FontSize=10
Text=#CURRENTSECTION#
LeftMouseUpAction=[!ActivateConfig "SegoeFluentIcons" "#CURRENTSECTION#.ini"][!SetOption [##Title#] Color #Color4#][!SetOption #Title# MeterStyle "sAllText | sContents"] [!UpdateMeter #CURRENTSECTION#][!Redraw]
RightMouseUpAction=["#SKINSPATH#\SegoeFluentIcons\#CURRENTSECTION#.ini"]
X=r
Y=2R
It seems to have turned off the highlighting, which is what I want. But the first set option doesn't work. In other words the Content title text stays white not the colour specified.

I think this is to do with the Nested Variable !SetOption [##Title#]? If that's what that is, I don't understand how that works, even after reading the manual. Just makes no sense to me! :oops: :?

EDIT: Actually the highlighting doesn't quite work. If you don't click and move the cursor off the text it stays highlighted!
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: OnRefreshAction

Post by death.crafter »

sl23 wrote: August 30th, 2021, 12:01 pm
Use everything in the include file.

In the skin where you don't need a particular style in a particular meter, define that meter before you include the inc file.

Example:

Include file:

Code: Select all

[Meter1]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle


[Meter2]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle


[Meter3]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle


[Meter4]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle


[Meter5]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle


[Meter6]
Meter=String
MeterStyle=PermanentStyle | TemporaryStyle
In config file:

Code: Select all

.....

[Meter6]
MeterStyle=PermanentStyle

@include=#@#Include.inc
Since, MeterStyle of Meter6 is defined before hand, it is not changed due to include file. Just keep in mind that Order of definition maters.
You may also include files within files. Once again, the ordering is determined by placement: when any file includes another file, the new contents are added within its own sections, immediately after the section where the statement is made.

If there is a conflict - that is, if the same section exists in more than one file - Rainmeter will treat whichever one comes first in the ordering as the "real" section. Any options on the later instances will be added to the first one, and otherwise the later instances are simply ignored. If there are different values given for the same key, the last value is taken. Unlike new sections, options on pre-existing sections are added in their original order, so the calling section may overwrite values from the included file if they are placed below the @include statement.
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

I thought that's how it worked, which kind of goes against the order process!
To my mind whatever duplicate section comes last should be the priority. As it is processed after the first, like everything else.
Strange that this works in reverse?

I was thinking along those lines of adding the section to the skin file, but thought @include had to be in the Rainmeter section?
Thanks dc :thumbup:
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

That didn't work. Because there's two sections with the same name they cancel each other out and nothing is displayed for that meter.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: OnRefreshAction

Post by death.crafter »

sl23 wrote: August 30th, 2021, 2:20 pm That didn't work. Because there's two sections with the same name they cancel each other out and nothing is displayed for that meter.
No it's not the case. You have to define like this:

INI:

Code: Select all

[OriginalMeter]
Meter=String
FontColor=255,0,0

@include=INC.inc
INC:

Code: Select all

[OriginalMeter]
FontColor=0,255,0
FontWeight=500
Text will be red with weight 500. The FontColor in INC will be ignored.

Similarly,

Code: Select all

@include=INC.inc

[OriginalMeter]
Meter=String
FontColor=255,0,0
Text will be green with weight 500. FontColor in INI will be ignored.

They DON'T CANCEL EACH OTHER OUT.
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

Sorry, but when I add this to the INC file

Code: Select all

[Template]
Meter=String
MeterStyle=sAllText | sContents | sHighlight
And this to the INI file

Code: Select all

[Template]
Meter=String
MeterStyle=sAllText | sContents

@include=#@#Meters.inc
then no meter is displayed with that text, ie the section name. :sly:

EDIT: Just tried removing Meter=String from the INI to see if that was the cause of it disappearing, seems it isn't! :uhuh:
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: OnRefreshAction

Post by sl23 »

Ah, I think the cause might be due to using relative positioning?
Post Reply