It is currently December 9th, 2021, 4:46 am

I have: title, artist, album and need scrolling... please

Help with creating, editing & fixing problems with skins
User avatar
creativegamer_03
Posts: 8
Joined: November 15th, 2021, 5:51 am

Re: I have: title, artist, album and need scrolling... please

Post by creativegamer_03 »

death.crafter wrote: November 15th, 2021, 5:44 pm I will post a complete example if he needs. But I think he has found a way. But yes, I will update it.
Actually, if you do have a better way to do it, please do post it. I'm welcome for better code. Also, if you can, I just need one marquee text scroll like the iphone music player for my screensaver skin.
Mine clearly has some issues with other loaded skins, which causes them to freeze and sometimes crashes Rainmeter.
rainmeter is just so cool
User avatar
death.crafter
Rainmeter Sage
Posts: 1208
Joined: April 24th, 2021, 8:13 pm

Re: I have: title, artist, album and need scrolling... please

Post by death.crafter »

creativegamer_03 wrote: November 15th, 2021, 11:55 pm Actually, if you do have a better way to do it, please do post it. I'm welcome for better code. Also, if you can, I just need one marquee text scroll like the iphone music player for my screensaver skin.
Mine clearly has some issues with other loaded skins, which causes them to freeze and sometimes crashes Rainmeter.
I'll try to make a working example when I get back to my pc.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I have: title, artist, album and need scrolling... please

Post by balala »

creativegamer_03 wrote: November 15th, 2021, 11:55 pm Actually, if you do have a better way to do it, please do post it. I'm welcome for better code.
In meantime while we're waiting for death.crafter's code, here is mine. Please check it. For now I worked only with the title, didn't so far with the artist. If you find the solution good enough, a similar technique can be used for the artist as well, to get it scrolling as well (can help with this as well).

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1
;OnRefreshAction=[!SetVariable Marquee1 0][!SetVariable Marquee2 0][!SetVariable Marquee3 0][!SetVariable Marquee4 0][!CommandMeasure MeasureActionTimer "Stop 1"][!CommandMeasure MeasureActionTimer "Stop 2"][!CommandMeasure MeasureActionTimer "Stop 3"][!CommandMeasure MeasureActionTimer "Stop 4"][!CommandMeasure MeasureActionTimer "Execute 1"][!CommandMeasure MeasureActionTimer "Execute 2"][!CommandMeasure MeasureActionTimer "Execute 3"][!CommandMeasure MeasureActionTimer "Execute 4"][!KeepOnScreen #KeepOnScreen#]

[Metadata]
Name=CoveR Left
Author=NikolaRabra (rabra.deviantart.com)
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=1 (20140909)

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

marquee1=0
marquee2=0
marquee3=0
marquee4=0

ProgressAlpha=1
Step=-1
NoTitleNameText=N/A
NoArtistNameText=N/A
NoAlbumNameText=N/A

; Added to test (Should be in your included variables.inc file)
TextWidth=300
Color=255,255,255,155
Alpha=300
HideInfo=0
KeepOnScreen=0

; Marquee settings
animationSpeed=1
marqueeBeginWait=3000
marqueeEndWait=3000
; Dynamic variables - do not change

StayVis=50
TitleStayVis=#StayVis#
EnTitle=0

; Styles ------------------------------------------------------------------------------------------

[StringStyleLarge]
FontFace=Segoe UI Light
FontColor=#Color#,(255*(#Alpha#))
;FontSize=19
FontSize=19
StringStyle=Normal
StringEffect=None
FontEffectColor=0,0,0,(255*(#Alpha#))
AntiAlias=1
Container=MeterTextContainer
DynamicVariables=1


; Measures ----------------------------------------------------------------------------------------

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=WMP
PlayerType=ARTIST
Substitute="":"#NoArtistNameText#"
OnChangeAction=[!SetVariable TitleStayVis "#StayVis#"][!UpdateMeasure "MeasureMarquee1Offset"]
;UpdateDivider=100
;OnChangeAction=[!Refresh "#CurrentConfig#"]

[MeasureAlbum]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=ALBUM
Substitute="":"#NoAlbumNameText#"
;UpdateDivider=100

[MeasureTitle]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=TITLE
Substitute="":"#NoTitleNameText#"
;UpdateDivider=100

[MeasureYear]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=YEAR

; Marquee Measures

[MeasureMarquee1Offset]
Measure=Calc
Formula=( max ( 0, [Title:W] ))
;Formula=( 2 * max ( 0, ( [Title:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee1_Offset]
Measure=Calc
Formula=( max( 0, ( [MeterTextContainer:W] - [Title:X] )))
DynamicVariables=1

[MeasureMarquee2Offset]
Measure=Calc
Formula=( 5 * max ( 0, ( [Artist:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee3Offset]
Measure=Calc
Formula=( 14 * max ( 0, ( [Album:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee4Offset]
Measure=Calc
Formula=( 14 * max ( 0, ( [Year:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureTitleLength]
Measure=Calc
Formula=( [Title:W] > #CURRENTCONFIGWIDTH# )
IfCondition=(MeasureTitleLength>=1)
IfTrueAction=[!SetVariable EnTitle "1"][!UpdateMeasure "MeasureActionTimer"][!CommandMeasure "MeasureActionTimer" "Execute 1"]
IfFalseAction=[!SetVariable EnTitle "0"][!SetVariable marquee1 "0"][!UpdateMeasure "MeasureActionTimer"][!CommandMeasure "MeasureActionTimer" "Stop 1"]
DynamicVariables=1

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
; Marquee 1
ActionList1=Repeat Move1,#animationSpeed#,[MeasureMarquee1Offset:]
; | Repeat HMove1,1,1 | Repeat Move1,#animationSpeed#,[MeasureMarquee1_Offset:] | Reset1 | Wait #marqueeBeginWait# | DoOver1
Reset1=[!SetVariable marquee1 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
Move1=[!SetVariable marquee1 "(#marquee1# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
HMove1=[!SetVariable marquee1 "[MeterTextContainer:W]"][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Execute 1"]
; Marquee 2
ActionList2=Repeat Move2,#animationSpeed#,[MeasureMarquee2Offset:] | Wait #marqueeEndWait# | Reset2 | Wait #marqueeBeginWait# | DoOver2
Reset2=[!SetVariable marquee2 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Artist][!Redraw]
Move2=[!SetVariable marquee2 "(#marquee2# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Artist][!Redraw]
DoOver2=[!CommandMeasure MeasureActionTimer "Execute 2"]
; Marquee 3
ActionList3=Repeat Move3,#animationSpeed#,[MeasureMarquee3Offset:] | Wait #marqueeEndWait# | Reset3 | Wait #marqueeBeginWait# | DoOver3
Reset3=[!SetVariable marquee3 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Album][!Redraw]
Move3=[!SetVariable marquee3 "(#marquee3# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Album][!Redraw]
DoOver3=[!CommandMeasure MeasureActionTimer "Execute 3"]
; Marquee 4
ActionList4=Repeat Move4,#animationSpeed#,[MeasureMarquee4Offset:] | Wait #marqueeEndWait# | Reset4 | Wait #marqueeBeginWait# | DoOver4
Reset4=[!SetVariable marquee4 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Year][!Redraw]
Move3=[!SetVariable marquee3 "(#marquee3# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Year][!Redraw]
DoOver4=[!CommandMeasure MeasureActionTimer "Execute 4"]
IfCondition=((Abs(#marquee1#)>=[MeasureMarquee1Offset:]-#TitleStayVis#)&&(#EnTitle#>=1))
IfTrueAction=[!CommandMeasure "MeasureActionTimer" "Stop 1"][!SetVariable marquee1 "0"][!UpdateMeasure "MeasureActionTimer"][!Redraw][!Delay "1000"][!CommandMeasure "MeasureActionTimer" "Execute 1"]
DynamicVariables=1

; Container to control scrolling based on TextWidth
[MeterTextContainer]
Meter=Image
SolidColor=255,255,255,155
X=1
Y=1
W=#TextWidth#
H=155

; Info Text ---------------------------------------------------------------------------------------

[Title]
Meter=STRING
MeasureName=MeasureTitle
MeterStyle=StringStyleLarge
StringAlign=LeftBottom
X=#marquee1#
Y=38
Text=%1
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Artist]
Meter=STRING
MeasureName=MeasureArtist
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee2#
Y=36
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Album]
Meter=STRING
MeasureName=MeasureAlbum
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee3#
Y=72
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Year]
Meter=STRING
MeasureName=MeasureYear
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee4#
Y=106
Group=Info
Hidden=#HideInfo#
StringStyle=bold
I added new variables (StayVis, TitleStayVis and EnTitle) and a new measure ([MeasureTitleLength]). The StayVis variable represents the length (in pixels) of the string which remains visible when the scrolling of title ends. You can set for this the value you want. The TitleStayVis and EnTitle variables are needed in the code, you shouldn't change / alter them.
Note that I rewrote the [MeasureArtist], [MeasureAlbum], [MeasureTitle] and [MeasureYear] measures to be NowPlaying measures, because even if a while ago NowPlaying was a plugin, in meantime it became an internal measure and should be used so. I also modified the Update value of the code (into the [Rainmeter] section) to the default Update=1000, because since the scrolling is controlled by an ActionTimer plugin measure, there is not needed to have such a low update value.
Please let me know if the skin works as expected, or if there is any trouble with it, a description of what isn't going on well.
User avatar
creativegamer_03
Posts: 8
Joined: November 15th, 2021, 5:51 am

Re: I have: title, artist, album and need scrolling... please

Post by creativegamer_03 »

balala wrote: November 16th, 2021, 7:27 pm In meantime while we're waiting for death.crafter's code, here is mine. Please check it. For now I worked only with the title, didn't so far with the artist. If you find the solution good enough, a similar technique can be used for the artist as well, to get it scrolling as well (can help with this as well).

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1
;OnRefreshAction=[!SetVariable Marquee1 0][!SetVariable Marquee2 0][!SetVariable Marquee3 0][!SetVariable Marquee4 0][!CommandMeasure MeasureActionTimer "Stop 1"][!CommandMeasure MeasureActionTimer "Stop 2"][!CommandMeasure MeasureActionTimer "Stop 3"][!CommandMeasure MeasureActionTimer "Stop 4"][!CommandMeasure MeasureActionTimer "Execute 1"][!CommandMeasure MeasureActionTimer "Execute 2"][!CommandMeasure MeasureActionTimer "Execute 3"][!CommandMeasure MeasureActionTimer "Execute 4"][!KeepOnScreen #KeepOnScreen#]

[Metadata]
Name=CoveR Left
Author=NikolaRabra (rabra.deviantart.com)
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=1 (20140909)

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

marquee1=0
marquee2=0
marquee3=0
marquee4=0

ProgressAlpha=1
Step=-1
NoTitleNameText=N/A
NoArtistNameText=N/A
NoAlbumNameText=N/A

; Added to test (Should be in your included variables.inc file)
TextWidth=300
Color=255,255,255,155
Alpha=300
HideInfo=0
KeepOnScreen=0

; Marquee settings
animationSpeed=1
marqueeBeginWait=3000
marqueeEndWait=3000
; Dynamic variables - do not change

StayVis=50
TitleStayVis=#StayVis#
EnTitle=0

; Styles ------------------------------------------------------------------------------------------

[StringStyleLarge]
FontFace=Segoe UI Light
FontColor=#Color#,(255*(#Alpha#))
;FontSize=19
FontSize=19
StringStyle=Normal
StringEffect=None
FontEffectColor=0,0,0,(255*(#Alpha#))
AntiAlias=1
Container=MeterTextContainer
DynamicVariables=1


; Measures ----------------------------------------------------------------------------------------

[MeasureArtist]
Measure=Plugin
Plugin=NowPlaying
PlayerName=WMP
PlayerType=ARTIST
Substitute="":"#NoArtistNameText#"
OnChangeAction=[!SetVariable TitleStayVis "#StayVis#"][!UpdateMeasure "MeasureMarquee1Offset"]
;UpdateDivider=100
;OnChangeAction=[!Refresh "#CurrentConfig#"]

[MeasureAlbum]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=ALBUM
Substitute="":"#NoAlbumNameText#"
;UpdateDivider=100

[MeasureTitle]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=TITLE
Substitute="":"#NoTitleNameText#"
;UpdateDivider=100

[MeasureYear]
Measure=NowPlaying
PlayerName=[MeasureArtist]
PlayerType=YEAR

; Marquee Measures

[MeasureMarquee1Offset]
Measure=Calc
Formula=( max ( 0, [Title:W] ))
;Formula=( 2 * max ( 0, ( [Title:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee1_Offset]
Measure=Calc
Formula=( max( 0, ( [MeterTextContainer:W] - [Title:X] )))
DynamicVariables=1

[MeasureMarquee2Offset]
Measure=Calc
Formula=( 5 * max ( 0, ( [Artist:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee3Offset]
Measure=Calc
Formula=( 14 * max ( 0, ( [Album:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureMarquee4Offset]
Measure=Calc
Formula=( 14 * max ( 0, ( [Year:W] - [MeterTextContainer:W] )))
DynamicVariables=1

[MeasureTitleLength]
Measure=Calc
Formula=( [Title:W] > #CURRENTCONFIGWIDTH# )
IfCondition=(MeasureTitleLength>=1)
IfTrueAction=[!SetVariable EnTitle "1"][!UpdateMeasure "MeasureActionTimer"][!CommandMeasure "MeasureActionTimer" "Execute 1"]
IfFalseAction=[!SetVariable EnTitle "0"][!SetVariable marquee1 "0"][!UpdateMeasure "MeasureActionTimer"][!CommandMeasure "MeasureActionTimer" "Stop 1"]
DynamicVariables=1

[MeasureActionTimer]
Measure=Plugin
Plugin=ActionTimer
; Marquee 1
ActionList1=Repeat Move1,#animationSpeed#,[MeasureMarquee1Offset:]
; | Repeat HMove1,1,1 | Repeat Move1,#animationSpeed#,[MeasureMarquee1_Offset:] | Reset1 | Wait #marqueeBeginWait# | DoOver1
Reset1=[!SetVariable marquee1 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
Move1=[!SetVariable marquee1 "(#marquee1# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
HMove1=[!SetVariable marquee1 "[MeterTextContainer:W]"][!UpdateMeasure MeasureActionTimer][!UpdateMeter "Title"][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer "Execute 1"]
; Marquee 2
ActionList2=Repeat Move2,#animationSpeed#,[MeasureMarquee2Offset:] | Wait #marqueeEndWait# | Reset2 | Wait #marqueeBeginWait# | DoOver2
Reset2=[!SetVariable marquee2 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Artist][!Redraw]
Move2=[!SetVariable marquee2 "(#marquee2# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Artist][!Redraw]
DoOver2=[!CommandMeasure MeasureActionTimer "Execute 2"]
; Marquee 3
ActionList3=Repeat Move3,#animationSpeed#,[MeasureMarquee3Offset:] | Wait #marqueeEndWait# | Reset3 | Wait #marqueeBeginWait# | DoOver3
Reset3=[!SetVariable marquee3 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Album][!Redraw]
Move3=[!SetVariable marquee3 "(#marquee3# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Album][!Redraw]
DoOver3=[!CommandMeasure MeasureActionTimer "Execute 3"]
; Marquee 4
ActionList4=Repeat Move4,#animationSpeed#,[MeasureMarquee4Offset:] | Wait #marqueeEndWait# | Reset4 | Wait #marqueeBeginWait# | DoOver4
Reset4=[!SetVariable marquee4 0][!UpdateMeasure MeasureActionTimer][!UpdateMeter Year][!Redraw]
Move3=[!SetVariable marquee3 "(#marquee3# - 1)"][!UpdateMeasure MeasureActionTimer][!UpdateMeter Year][!Redraw]
DoOver4=[!CommandMeasure MeasureActionTimer "Execute 4"]
IfCondition=((Abs(#marquee1#)>=[MeasureMarquee1Offset:]-#TitleStayVis#)&&(#EnTitle#>=1))
IfTrueAction=[!CommandMeasure "MeasureActionTimer" "Stop 1"][!SetVariable marquee1 "0"][!UpdateMeasure "MeasureActionTimer"][!Redraw][!Delay "1000"][!CommandMeasure "MeasureActionTimer" "Execute 1"]
DynamicVariables=1

; Container to control scrolling based on TextWidth
[MeterTextContainer]
Meter=Image
SolidColor=255,255,255,155
X=1
Y=1
W=#TextWidth#
H=155

; Info Text ---------------------------------------------------------------------------------------

[Title]
Meter=STRING
MeasureName=MeasureTitle
MeterStyle=StringStyleLarge
StringAlign=LeftBottom
X=#marquee1#
Y=38
Text=%1
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Artist]
Meter=STRING
MeasureName=MeasureArtist
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee2#
Y=36
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Album]
Meter=STRING
MeasureName=MeasureAlbum
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee3#
Y=72
Group=Info
Hidden=#HideInfo#
StringStyle=bold

[Year]
Meter=STRING
MeasureName=MeasureYear
MeterStyle=StringStyleLarge
StringAlign=LeftTop
Text=%1
X=#marquee4#
Y=106
Group=Info
Hidden=#HideInfo#
StringStyle=bold
I added new variables (StayVis, TitleStayVis and EnTitle) and a new measure ([MeasureTitleLength]). The StayVis variable represents the length (in pixels) of the string which remains visible when the scrolling of title ends. You can set for this the value you want. The TitleStayVis and EnTitle variables are needed in the code, you shouldn't change / alter them.
Note that I rewrote the [MeasureArtist], [MeasureAlbum], [MeasureTitle] and [MeasureYear] measures to be NowPlaying measures, because even if a while ago NowPlaying was a plugin, in meantime it became an internal measure and should be used so. I also modified the Update value of the code (into the [Rainmeter] section) to the default Update=1000, because since the scrolling is controlled by an ActionTimer plugin measure, there is not needed to have such a low update value.
Please let me know if the skin works as expected, or if there is any trouble with it, a description of what isn't going on well.
The text did scroll to the left, but it is not as I expect it to be... The title scrolls to the left, but it did not hide all the text to the left side and reappear on the right side after disappearing. It just then goes back to the origin in a flash. Well at least it is more stable than before, which caused other loaded skins to freeze and potentially crash Rainmeter itself, so ig this is a start.
What I actually want was the title to scroll like the iPhone music player (or any new smartphone music player) when it is too long, which it would scroll to the left, hiding all the title text, then reappear from the right, and finally pause at the origin.
I actually did it on a skin I'm making, but it caused other skins to freeze, and did almost crash Rainmeter. I added an action that would move the title text to the right while keeping the text hidden (setting the X value equal to the Title's container's width value), which is HMove1, then make it move to the left once more using Move1, but with the repeat value from [MeasureMarqueeText1_Offset] so that it exactly stops at the origin.
By the way, you can check my skin's code if there's something you want to check and optimize. It's a screensaver skin.
You do not have the required permissions to view the files attached to this post.
rainmeter is just so cool
User avatar
1690Cat
Posts: 22
Joined: September 27th, 2012, 3:02 pm

Re: I have: title, artist, album and need scrolling... please

Post by 1690Cat »

I think this is what you may be looking for,found it a few years ago and altered for my own needs,can't remember the original Author but credits to him/her for some of the code,maybe you can integrate it into your skin..
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 13533
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I have: title, artist, album and need scrolling... please

Post by balala »

creativegamer_03 wrote: November 18th, 2021, 6:55 am By the way, you can check my skin's code if there's something you want to check and optimize. It's a screensaver skin.
Don't know, because the scrolling in you skin doesn't go on properly, it being too narrow.
what I definitely see in your code is that the NowPlaying measures should have a parent - child structure. In your code these measures are all parent measures, all having a PlayerName=#Player# option. This option should have been set only on one measure (this being the parent measure) and on all others the PlayerName option should be set to the parent measure (for instance PlayerName=[mTitle]:

Code: Select all

[CoverArt]
...
PlayerName=[mTitle]
...

[Dur]
...
PlayerName=[mTitle]
...

[Pos]
...
PlayerName=[mTitle]
...

[mTitle]
...
PlayerName=#Player#
...

[mArtist]
...
PlayerName=[mTitle]
...

[mYear]
..
PlayerName=[mTitle]
...

[mAlbum]
...
PlayerName=[mTitle]
...

[mGenre]
...
PlayerName=[mTitle]
...

[mTrack]
...
PlayerName=[mTitle]
...

[Progress]
...
PlayerName=[mTitle]
...

[mState]
...
PlayerName=[mTitle]
...