It is currently May 8th, 2024, 7:35 pm

Solved: Change Opacity/FontColor as per Conditions.

Get help with creating, editing & fixing problems with skins
ZXCVBOT

Solved: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

Condition being when shuffle is ON/1 the Transperancy/Opacity should be 255 else it should be 200.

What did I try (unable to understand the reason all did not work):
Changing fontcolor as per rrr,ggg,bbb,aaa in condition (not manually in the meter).
Using !SetOption Bang properly.
Using !WriteKeyValue properly - Used it couple of more times in the program and they all work.
Using !SetTransperancy (What could have gone wrong here?).

All lead to one conclusion: Wrong condition stated.

What I need: Help in writing the correct condition along with the true and false action (either or is fine) to change the opacity as per the state of shuffle (or even repeat - one solution for all).

Code: Contains unicode characters, so provided a way-out just change the ShuffleText variable to whatever you want.

Code: Select all

[Variables]

PlayerName=AIMP

FontName=Segoe UI
FontColor=200,200,200
HighlightColor=255,255,255

ShuffleText=πŸ”€

[MeasureNowPlaying]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Progress
AverageSize=6
MinValue=0
MaxValue=100

[MeasureShuffle]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PLayerName#
PlayerType=Shuffle
Substitute="0":"#ShuffleText#","1":"#ShuffleText#"

[M_Shuffle]
Meter=String
MeasureName=MeasureShuffle
X=(([M_Track:W])-378)
Y=([M_Bar:Y]+(8*#Scale#))
FontFace=#FONTNAME#
FontColor=#FONTCOLOR#
FontSize=15
Text=%1
ClipString=1
AntiAlias=1
DynamicVariables=1

;IfCondition=([MeasureShuffle]=1)
;IfTrueAction=[!SetOption M_Shuffle FontColor #HighlightColor#,255][!Redraw]
;IfFalseAction=[!SetOption M_Shuffle FontColor #FONTCOLOR#,150][!Redraw]

;IfCondition=([MeasureShuffle]=1)
;IfTrueAction=[!SetTransparency 100][!Redraw]
;IfFalseAction=[!SetTransparency 255][!Redraw]

LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "SetShuffle -1"][!Redraw]

TLDR: Change the opacity of text in M_Shuffle when MeasureShuffle is 1 or 0.

Thanks in advance.
Last edited by ZXCVBOT on October 4th, 2023, 5:38 pm, edited 1 time in total.
ZXCVBOT

Re: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

Mistake (Pointed by Yincognito somewhere else): I used the conditions in meter instead of the measure!
User avatar
Yincognito
Rainmeter Sage
Posts: 7211
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Change Opacity/FontColor as per Conditions.

Post by Yincognito »

ZXCVBOT wrote: ↑October 4th, 2023, 5:38 pm Mistake (Pointed by Yincognito somewhere else): I used the conditions in meter instead of the measure!
Right. Besides that, you don't even need an IfCondition at all, it can be done via a numerical conditional (roughly the same as an IfCondition, but shorter) - just get rid of the IfCondition and add ,([MeasureShuffle:]=1?255:200) to the value of the FontColor option, to include a suited conditional for the alpha / aaa value for the said color.

Code: Select all

[Variables]

PlayerName=AIMP

FontName=Segoe UI
FontColor=200,200,200
HighlightColor=255,255,255

ShuffleText=πŸ”€

[MeasureNowPlaying]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Progress
AverageSize=6
MinValue=0
MaxValue=100

[MeasureShuffle]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Shuffle
Substitute="0":"#ShuffleText#","1":"#ShuffleText#"

[M_Shuffle]
Meter=String
MeasureName=MeasureShuffle
X=(([M_Track:W])-378)
Y=([M_Bar:Y]+(8*#Scale#))
FontFace=#FONTNAME#
FontColor=#FONTCOLOR#,([MeasureShuffle:]=1?255:200)
FontSize=15
Text=%1
ClipString=1
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "SetShuffle -1"][!UpdateMeter M_Shuffle][!Redraw]
Note that since your MeasureShuffle has different number and string values (i.e. 0 or 1 vs the shuffle text), you have to specifically use the number value in the conditional, via the corresponding section variable parameter for measures.



Other than that, I think you have just discovered a bug in NowPlaying - when setting the shuffle setting from the player and not the skin, this is not reflected in the measure from the skin, although it should be:
NowPlaying Shuffle Bug.jpg
This is present for Winamp 5.9.2.10042 x86 and multiple skins, not just this one. Can this be confirmed by you or anyone else watching this for other skins / players?
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
ZXCVBOT

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

Yes, this is true in my case too.
But, as you already told, this happens only when I use Shuffle from the player and not the skin.

Do I have to report this bug somewhere? Is this only in NowPlaying plugin or also for WebNowPlaying?

Edit: Just did: https://forum.rainmeter.net/viewtopic.php?t=42977
Last edited by ZXCVBOT on October 4th, 2023, 7:08 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7211
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by Yincognito »

ZXCVBOT wrote: ↑October 4th, 2023, 6:45 pm Yes, this is true in my case too.
But, as you already told, this happens only when I use Shuffle from the player and not the skin.

Do I have to report this bug somewhere? Is this only in NowPlaying plugin or also for WebNowPlaying?
Rainmeter Version: 4.5.18.3727 (x64)
Thanks for confirming. Yes, it can be posted in the Bugs & Feature Suggestion section of the forum. It's likely that this happens only when using NowPlaying measures, since the WebNowPlaying development is separate from the former.
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
ZXCVBOT

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

This is also true for Repeat. Just confirm it with other skins/players.
User avatar
Yincognito
Rainmeter Sage
Posts: 7211
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by Yincognito »

ZXCVBOT wrote: ↑October 4th, 2023, 7:51 pm This is also true for Repeat. Just confirm it with other skins/players.
You're right, it happens with Repeat as well, for my Winamp and any player like skin. Good catch. :thumbup:
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
ZXCVBOT

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

Follow-up: If I want to use the Mouse Hover on the buttons, whilst keeping the condition part, can it be done?

I tried and had to comment out the MouseOver and MouseLeave Actions (Don't bother about StringStyle), but it was not working alongside the FontColor, or so I think, otherwise it works perfectly:

Code: Select all

[Variables]

PlayerName=AIMP

FontName=Segoe UI
FontColor=200,200,200
HighlightColor=255,255,255

ShuffleText=πŸ”€

[MeasureNowPlaying]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Progress
AverageSize=6
MinValue=0
MaxValue=100

[MeasureShuffle]
Measure=Plugin
Plugin=NowPlaying
PlayerName=#PlayerName#
PlayerType=Shuffle
Substitute="0":"#ShuffleText#","1":"#ShuffleText#"

[M_Shuffle]
Meter=String
MeasureName=MeasureShuffle
;X=(([M_Track:W])-378)
;Y=([M_Bar:Y]+(8*#Scale#))
FontFace=#FONTNAME#
FontColor=#FONTCOLOR#,([MeasureShuffle:]=1?255:200)
FontSize=12
Text=%1
ClipString=1
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "SetShuffle -1"][!UpdateMeter M_Shuffle][!Redraw]
;MouseOverAction=[!SetOption M_Shuffle FontColor #HighlightColor#,255]
;MouseLeaveAction=[!SetOption M_Shuffle FontColor #FONTCOLOR#,255]
;[!SetOption M_Shuffle StringStyle ""]
User avatar
Yincognito
Rainmeter Sage
Posts: 7211
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by Yincognito »

ZXCVBOT wrote: ↑October 5th, 2023, 12:16 pm Follow-up: If I want to use the Mouse Hover on the buttons, whilst keeping the condition part, can it be done?

I tried and had to comment out the MouseOver and MouseLeave Actions (Don't bother about StringStyle), but it was not working alongside the FontColor, or so I think, otherwise it works perfectly: [...]
I believe that what you want is to revert / restore to the original / initial form of the value in the FontColor option, when the mouse leaves the meter, in other words using the repeat toggle automatic coloring alongside highlighting on hover. If that's the case, then escaping variables to their literal form when setting the option on mouse leave might help:

MouseOverAction=[!SetOption M_Shuffle FontColor "#HighlightColor#,255"][!UpdateMeter M_Shuffle][!Redraw]
MouseLeaveAction=[!SetOption M_Shuffle FontColor "#*FONTCOLOR*#,([*MeasureShuffle:*]=1?255:100)"][!UpdateMeter M_Shuffle][!Redraw]


This will set back the FontColor option to the exact same string value as it is in the initial code, allowing Rainmeter to parse that string like it did before mousing over on the meter, despite the latter altering the option. I've also added quotes to enclose those color values, since they help avoid potential incorrect parsing of such parameters in bangs, especially when the said parameters include spaces.
Profiles: Rainmeter Profile β—‡ DeviantArt Profile β—† Suites: MYiniMeter β—† Skins: Earth
ZXCVBOT

Re: Solved: Change Opacity/FontColor as per Conditions.

Post by ZXCVBOT »

Well, Thanks again!

Even if I would've guessed the quotes, I would be stuck again without an "Escape" (see what I did there?). :D
Talking of spaces, unrelated to this forum: paths to file: they may contain spaces, but how does rainmeter handle them?

I tried:
Path\To File\Blah.exe
"Path\To File\Blah.exe"
Path\"To File"\Blah.exe & Path\'To File'\Blah.exe
(Path\To File\Blah.exe)
...
Declared the path as a variable and file as another and referred/linked them to one other variable.

But none are working. Also, before you send me a manual link, check it yourself, they do not contain anything about spaces. Yet, the 1st, 2nd and 3rd work normally "just exactly as it is in Windows or a command window (DOS)" (referring to the 1st link below). Somehow, the ones without spaces work.

https://forum.rainmeter.net/viewtopic.php?t=16432
https://docs.rainmeter.net/manual/skins/