It is currently April 23rd, 2024, 5:29 am

How do i hide a skin when music is not playing?

Get help with creating, editing & fixing problems with skins
NickMihal
Posts: 6
Joined: September 30th, 2018, 12:32 pm

How do i hide a skin when music is not playing?

Post by NickMihal »

Hello, i have 2 skins that i want to auto hide when music is paused/stopped but i don't know how can you help me ? Thanks.

First skin

Code: Select all

[Rainmeter]
Update=#Rm.Updiv#
AccurateText=1
DefaultKeepOnScreen=0
DefaultUpdateDivider=-1
OnRefreshAction=[!Delay 100][!enablemeasuregroup NUOL][!CommandMeasure Func "checkMedia#MediaType#()"]
; backgroundmode=2
; solidcolor=255,255,255,50

@includeCtx=#SKINSPATH##JaxCore\CoreShell\}{CtxItms.inc

[Metadata]
Name=Now Playing
Author=
Information=
License=
Version=

[Variables]
Rm.Updiv=1000
Sec.Ctx.Pos=1
Sec.Ctx.Blur=0

@includeVars=#@#Vars.inc
@includeStyleVars=Vars\#Style#.inc

Mouse.0Pos=0
Mouse.1Pos=0

NowPlayingMedia=CAD
PlayerType=WNP

@includeMusic=#@#Includes\GlobalMusic#MediaType#.inc
@includeStyles=#@#Includes\GlobalStyles.inc
@includePlayer=Styles\#Style#.inc

[Func]
Measure=Script
ScriptFile=#@#Lua\Func.lua

; [mAction]
; Measure=Calc
; Formula=#Mouse.1Pos# - #Mouse.0Pos#
; IfCondition=mAction > 10
; IfTrueAction=[!CommandMeasure State#NowPlayingMedia# "Next"]
; IfCondition2=mAction < -10
; IfTrueAction2=[!CommandMeasure State#NowPlayingMedia# "Previous"]
; IfCondition3=(mAction >= -10) && (mAction <= 10)
; IfTrueAction3=[!CommandMeasure State#NowPlayingMedia# "PlayPause"]
; DynamicVariables=1
; IfConditionMode=1
; Group=NUOL
; Disabled=1
Second Skin

Code: Select all

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


[Metadata]
Name=Simple Lyrics Display
Author=Harman A.W. | Apu889
Information=
Version=1.01

[Variables]
@include=#@#Variables.inc

; Determine total-height of the lyrics
Offset=0

[MeasureArtis]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#Player#
PlayerType=ARTIST


[MeasureTitle]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#Player#
PlayerType=TITLE
PlayerPath=
Substitute="":"‿ - "

[MeasureProgress]
Measure=Plugin
Plugin=#Plugin#
PlayerName=[MeasureArtis]
PlayerType=PROGRESS
Type=Progress

[MeasureSpotify]
Measure=String
String=#Plugin#
IfMatch="SpotifyPlugin"
IfMatchAction=[!SetOption "cCounter" "Formula" "((#*Offset*#)/100*([*MeasureProgress*]*100))"]
UpdateDivider=-1

[MeasureCheck]
Measure=String
String=[MeasureArtis] - [MeasureTitle]
RegExpSubstitute=1
Substitute="\(([^)]+)\)":"", "\[([^)]+)\]":"", "\.":"", "\040":" ", "-\z":"", "\+\z":"", " and ":" ", " x ":" ", " vs ":" ", " VS ":" ", " Vs ":" ", "\,":"", " Feat.*":"", " feat.*":"", " ft.*": "", " Ft.*":""
IfMatch=" - ‿ - "
IfNotMatchAction=[!EnableMeasure "MeasureCari"][!SetOption "MeterLyric" "Text" "#Searching#"][!UpdateMeter "MeterTracks"]
IfMatch2=#LastPlay#
IfMatchAction2=[!DisableMeasure "MeasureCari"][!SetOption "MeterLyric" "Text" "#*LastLyric*#"][!SetOption "MeterTemp" "Text" "#*LastLyric*#"][!UpdateMeter "MeterTemp"]
IfCondition=#AlbumArt# = 1
IfTrueAction=[!EnableMeasure "MeasureArt"][!ShowMeter "MeterArt"]
IfCondition2=#AutoScroll# = 1
IfTrueAction2=[!SetOption "MeterLyric" "Y" "(#*Y*#-[*cCounter*])"][!SetOption "MeterLyric" "H" "(#*SkinHeight*#+[*cCounter*])"][!SetOption "MeterLyric" "MouseScrollDownAction" ""][!SetOption "MeterLyric" "MouseScrollUpAction" ""]
IfFalseAction2=[!SetVariable "AutoScrollMult" "100"][!DisableMeasure "MeasureProgress"][!DisableMeasure "cCounter"]
DynamicVariables=1

[MeasureArt]
Measure=Plugin
Plugin=#Plugin#
PlayerName=[MeasureArtis]
PlayerType=Cover
Type=AlbumArt
Res=85
RegExpSubstitute=1
Substitute=".*folder\.jpg":"#@#none.png"
CoverPath=#@#AlbumArt.png
DefaultPath=#@#None.png
OnChangeAction=[!UpdateMeter "MeterArt"]
Disabled=1

[MeasureCari]
Measure=Plugin
Plugin=WebParser
URL=https://www.musixmatch.com/search/[&MeasureCheck]/tracks
RegExp='href=\"\/lyrics\/.*?\">'
RegExpSubstitute=1
Substitute='href="':"https://www.musixmatch.com", '">': ""
OnChangeAction=[!SetOption "MeasureMatch" "URL" [MeasureCari]][!SetVariable "LastURL" [MeasureCari]][!WriteKeyValue "Variables" "LastURL" [MeasureCari] "#@#Variables.inc"][!UpdateMeter "MeterTracks"]
OnConnectErrorAction=[!SetOption "MeterLyric" "Text" "#ConnectionError#"]
OnRegExpErrorAction=[!SetOption "MeterLyric" "Text" "#LyricNotFound#"]
DynamicVariables=1
Disabled=1

[MeasureMatch]
Measure=Plugin
Plugin=WebParser
URL=[Dummies]
RegExp=explicit\"\:.,\"body\":.*?,\"language\"|"instrumental":1
RegExpSubstitute=1
Substitute="\\n":"#CRLF#", "(?si)\n":"#xCRLFx#", "xCRLFx":"CRLF", 'explicit".*dy":"':'', '","language"':'', '"instrumental":1':'Instrumental', '\\"':''
OnRegExpErrorAction=[!SetOption "MeterLyric" "Text" "#FoundPageNotLyric#"], [!SetOption "MeasureCari" "UpdateDivider" "-1"]
OnChangeAction=[!WriteKeyValue "Variables" "LastPlay" "[MeasureCheck]" "#@#Variables.inc"][!WriteKeyValue "Variables" "LastLyric" "[MeasureMatch]" "#@#Variables.inc"][!SetOption "MeterTemp" "Text" [MeasureMatch]][!UpdateMeter "MeterTemp"][!SetOption "Meterlyric" "Text" [MeasureMatch]][!SetOption "MeasureCari" "UpdateDivider" "-1"][!SetOption "MeasureMatch" "UpdateDivider" "-1"]
DynamicVariables=1

[cCounter]
Measure=Calc
Formula=(#Offset#)/100*[MeasureProgress]
DynamicVariables=1

[TemplateMeter]
X=#X#
W=#SkinWidth#
ClipString=2
AntiAlias=1
StringAlign=#TextAlign#
FontFace=#Font#
FontSize=#FontSize#
FontColor=#TextColor#,(#TextColorA#*255/100)
StringStyle=#TextStyle#
StringEffect=#TextEffect#
SolidColor=#Background#,(#BackgroundA#*255/100)
Padding=#SkinPadding#,#SkinPadding#,#SkinPadding#,#SkinPadding#
AntiAlias=1
UpdateDivider=-1

[MeterTemp]
Meter=String
MeterStyle=TemplateMeter
UpdateDivider=-1
DynamicVariables=1
OnUpdateAction=[!SetVariable "Offset" """([MeterTemp:H] > [MeterLyric:H] ? (#AutoScrollMult#*([MeterTemp:H]-[MeterLyric:H])/100) : 0)"""][!SetOption "MeasureTitle" "OnChangeAction" "!Refresh"][!SetOption "MeasureCheck" "UpdateDivider" "-1" ][!Redraw]
SolidColor=0,0,0,0
FontColor=0,0,0,0
StringEffect=None
Y=0

[MeterArt]
Meter=Image
MeasureName=MeasureArt
X=0
Y=0
H=(([MeterLyric:H])+([MeterTracks:H]))
W=([MeterLyric:W])
ImageAlpha=(#AlbumArtA#*255/100)
PreserveAspectRatio=2
DynamicVariables=1
UpdateDivider=-1
OnUpdateAction=[!Redraw]
Hidden=1

[MeterLyric]
Meter=STRING
MeterStyle=TemplateMeter
Y=#Y#
H=(#SkinHeight#-#Y#)
Padding=#SkinPadding#,#SkinPadding#,#SkinPadding#,0
Text=#NotPlaying#
MouseScrollDownAction=[!SetVariable Y "(Clamp((#Y#-#ScrollSpeed#),-#Offset#,0))"][!UpdateMeter "MeterLyric"][!Redraw]
MouseScrollUpAction=[!SetVariable Y "(Clamp((#Y#+#ScrollSpeed#),-#Offset#,0))"][!UpdateMeter "MeterLyric"][!Redraw]
ToolTipText=Left click to open the menu#CRLF#Use mousewheel to scroll the lyric
ToolTipHidden=#DisableTooltip#
DynamicVariables=1
MouseActionCursor=0
UpdateDivider=1
LeftMouseUpAction=[!ToggleConfig "#ROOTCONFIG#\SettingsMisc" "ContextMenu.ini"]

[MeterTracks]
Meter=STRING
MeterStyle=TemplateMeter
Y=([MeterLyric:Y]+[MeterLyric:H])
Padding=#SkinPadding#,#TheMargin#,#SkinPadding#,#SkinPadding#
StringStyle=Bold
Text=[MeasureArtis] - [MeasureTitle]
LeftMouseDownAction=[#LastURL#]
ToolTipText=Click to visit the lyrics page
ToolTipHidden=#DisableTooltip#
Hidden=#DisableTrackInfo#
OnUpdateAction=[!SetOption "MeterTracks" "UpdateDivider" "-1"]
UpdateDivider=-1
DynamicVariables=1

User avatar
tass_co
Posts: 516
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: How do i hide a skin when music is not playing?

Post by tass_co »

NickMihal wrote: August 1st, 2022, 9:40 pm Hello, i have 2 skins that i want to auto hide when music is paused/stopped but i don't know how can you help me ? Thanks.
You can look State and Status from https://docs.rainmeter.net/manual/measures/nowplaying/#PlayerType

IfCondition sample code

Code: Select all

[MeasureMedia]
Measure=NowPlaying
PlayerName=PLAYERNAME
PlayerType=State
;stopped
IfCondition= MeasureMedia=0
IfTrueAction=[!DeactivateConfig "SECONDSKINPATH"]
;playing
IfCondition2= MeasureMedia=1
IfTrueAction2=[!ActivateConfig "SECONDSKINPATH" "SKINNAME.ini"]
;paused
IfCondition3= MeasureMedia=2
IfTrueAction3=[!DeactivateConfig "SECONDSKINPATH"]
IfConditionMode=1
DynamicVariables=1
Skin Activate/Deactivate => https://docs.rainmeter.net/manual/bangs/#ActivateConfig
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
balala
Rainmeter Sage
Posts: 16162
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How do i hide a skin when music is not playing?

Post by balala »

NickMihal wrote: August 1st, 2022, 9:40 pm Hello, i have 2 skins that i want to auto hide when music is paused/stopped but i don't know how can you help me ? Thanks.
tass_co's idea is good, however what am I not sure about is what you want to achieve. What he said is to activate and deactivate (so load and unload) the skin(s), but you asked about hiding the skins, which is a completely different operation. When you hide a skin, it remains activated / loaded, but can't be seen, being hidden. In such cases the skin consumes the appropriate resources, for instance loads the CPU, but as said, you can't see it. If this is what you want to achieve, tass_co's code should be modified a little bit, for example this way:

Code: Select all

[MeasureMedia]
Measure=NowPlaying
PlayerName=PLAYERNAME
PlayerType=State
;stopped
IfCondition=(MeasureMedia=0)
IfTrueAction=[!HideFade "ConfigName"]
;playing
IfCondition2=(MeasureMedia=1)
IfTrueAction2=[!ShowFade "ConfigName"]
;paused
IfCondition3=(MeasureMedia=2)
IfTrueAction3=[!HideFade "ConfigName"]
Note that in the !HideFade and !ShowFade bangs, you have to add the name of the config, not the skins path, which is a different thing. The name of the config is the name of the folder which contains the skins .ini file, STARTING from the Skins folder. For instance if your skin is C:\Users\YourName\Documents\Rainmeter\Skins\illustro\Clock\Clock.ini, the appropriate config is illustro\Clock. Otherwise the same things applies to the !DeactivateConfig and to the first parameter of the !ActivateConfig bangs, the parameter of !DeactivateConfig, same way as the first parameter of !ActivateConfig has to be the config as well.
And one more small detail, which can shorten a little bit the code of the above measure: The first and third case (so when the measure is 0 or 2) can be treated into one single option, this way:

Code: Select all

[MeasureMedia]
Measure=NowPlaying
PlayerName=PLAYERNAME
PlayerType=State
IfCondition=(MeasureMedia=1)
IfTrueAction=[!ShowFade "ConfigName"]
IfFalseAction=[!HideFade "ConfigName"]
And note one more extremely important detail: in order to get this working, you have to:
  • Have activated the skin which you want to hide or show. The !HideFade and !ShowFade bangs don't activate the skin, but leads to an error in the log, if the skin is not active.
  • Have activated the skin which contains the above measure as well.
If you can't deal with all this, please let me know what is the skin which has to check if the music is playing and which are the skins which have to be showed / hided.