It is currently June 26th, 2024, 10:12 am

Scrolling text

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16342
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Scrolling text

Post by balala »

Yincognito wrote: April 8th, 2020, 7:02 pm and it didn't scroll at all.
I'm surprised, because it does for me:
GIF.gif
You do not have the required permissions to view the files attached to this post.
Crash
Posts: 47
Joined: February 12th, 2020, 1:53 am

Re: Scrolling text

Post by Crash »

Yincognito wrote: April 8th, 2020, 6:51 pm Ok, so apparently me and balala are twins LOL, as we both seem to finish things simultaneously (no pun intended, LMAO). My version of the code, which has everything that you need:
- scrolling if whichever of the artist or title is greater than the width of the container
- eating out the characters like in the clip you posted, i.e. from left to right, right after finishing scrolling (if there's any scroll, that is, since "shorter" artist+title tuples than the width of the container won't scroll, obviously)
- it attempts to "detect" when the song has been changed, in order to start scrolling and then eating out chars on every song change

The code:

Code: Select all

[Rainmeter]
Update=1000
MouseOverAction=[!ShowMeterGroup Hover][!ShowMeterGroup #stowAwayName#][!Redraw]
MouseLeaveAction=[!HideMeterGroup Hover][!HideMeterGroup #stowAwayName#][!Redraw]
AccurateText=1
DynamicWindowSize=1
SkinHeight=(#skinSize#*0.25)

ContextTitle=Open Settings panel
ContextAction=!ActivateConfig "Cleartext\Settings"
ContextTitle2=Use Cleartext Pure
ContextAction2=!ActivateConfig "Cleartext"

[Metadata]
Name=Cleartext
Author=Redsaph
Description=Displays track information from various media players.
Version=5.2
License=Creative Commons BY-NC-SA 3.0

[Variables]
@include=#@#base.ini
currentlySetAlign=right
Width=300
Speed=5
EatCharUpdate=150
IntegralTopTextWidth=0
IntegralBottomTextWidth=0

; STYLES ==========================================
[styleTextControls]
FontFace=#controlsFont#
FontSize=(#skinSize#*0.027)
AntiAlias=1
FontColor=#translucent#
StringAlign=#interfaceTextAlignment#
DynamicVariables=1
Hidden=1
Group=Hover | Visible
MouseActionCursor=1

[styleTextMini]
FontFace=#controlsFont#
FontSize=(#skinSize#*0.0175)
AntiAlias=1
FontColor=#opaque#
StringAlign=#interfaceTextAlignment#
DynamicVariables=1
Hidden=1
Group=Hover | Visible

[styleTextMajor]
H=(#skinSize#*0.085)
FontSize=(#skinSize#*0.0625)
FontColor=#opaque#
AntiAlias=1
Group=Visible

; =================================================
; Measures

[LuaSettings]
Measure=Script
ScriptFile=#@#settings.lua

[mLastTexts]
Measure=String
String=""
DynamicVariables=1

[mTexts]
Measure=String
String="[#topText##MusicSwitch#] - [#bottomText##MusicSwitch#], [mLength#MusicSwitch#]"
IfMatch=^[mLastTexts:EscapeRegExp]$
IfNotMatchAction=[!DisableMeasure "MeasureScroll"][!UpdateMeasure "MeasureScroll"][!DisableMeasure "MeasureEatTopTextChars"][!UpdateMeasure "MeasureEatTopTextChars"][!DisableMeasure "MeasureEatBottomTextChars"][!UpdateMeasure "MeasureEatBottomTextChars"][!SetOption IntegralTopText Text "[#topText##MusicSwitch#]"][!UpdateMeter IntegralTopText][!SetOption IntegralBottomText Text "[#bottomText##MusicSwitch#]"][!UpdateMeter IntegralBottomText][!SetOption TopText Text "[#topText##MusicSwitch#]"][!UpdateMeter TopText][!SetOption BottomText Text "[#bottomText##MusicSwitch#]"][!UpdateMeter BottomText][!SetOption MeasureEatTopTextChars String "[#topText##MusicSwitch#]"][!UpdateMeasure "MeasureEatTopTextChars"][!SetOption MeasureEatBottomTextChars String "[#bottomText##MusicSwitch#]"][!UpdateMeasure "MeasureEatBottomTextChars"][!SetOption mLastTexts String "[mTexts]"][!UpdateMeasure "mLastTexts"][!EnableMeasure "MeasureScroll"]
IfMatchMode=1
DynamicVariables=1

[mTopTextWidth]
Group=AlignmentMeasure
Measure=Calc
Formula=[TopText:W]
OnChangeAction=[!WriteKeyValue Variables topTextWidth "[mTopTextWidth]" "#@#variables.inc"]
DynamicVariables=1

[mBottomTextWidth]
Group=AlignmentMeasure
Measure=Calc
Formula=[BottomText:W]
OnChangeAction=[!WriteKeyValue Variables bottomTextWidth "[mBottomTextWidth]" "#@#variables.inc"][!CommandMeasure "LuaAlign" "alignRightOnUpdate()"]
DynamicVariables=1

[LuaAlign]
Measure=Script
ScriptFile=#@#align.lua
UpdateDivider=8
DynamicVariables=1

[MeasureScroll]
Disabled=1
Measure=Calc
Formula=((MeasureScroll+#Speed#)>=(Max(#IntegralTopTextWidth#,#IntegralBottomTextWidth#)-#Width#)?(MeasureScroll):(MeasureScroll+#Speed#))
OnUpdateAction=[!SetOption TopText X "(#IntegralTopTextWidth#-[MeasureScroll])"][!UpdateMeter TopText][!SetOption BottomText X "(#IntegralBottomTextWidth#-#IntegralTopTextWidth#)r"][!UpdateMeter BottomText][!Redraw]
IfCondition=((MeasureScroll+#Speed#)>=(Max(#IntegralTopTextWidth#,#IntegralBottomTextWidth#)-#Width#)) && (mTopTextWidth<>0)
IfTrueAction=[!EnableMeasure "MeasureEatTopTextChars"]
IfCondition2=((MeasureScroll+#Speed#)>=(Max(#IntegralTopTextWidth#,#IntegralBottomTextWidth#)-#Width#)) && (mBottomTextWidth<>0)
IfTrueAction2=[!EnableMeasure "MeasureEatBottomTextChars"]
IfConditionMode=1
DynamicVariables=1

[MeasureEatTopTextChars]
Disabled=1
Measure=String
String=""
UpdateDivider=(#EatCharUpdate#/50)
RegExpSubstitute=1
Substitute="^.{1}(.*)$":"\1","^\\1$":""
IfMatch=^$
IfMatchAction=[!SetOption TopText Text ""][!UpdateMeter "TopText"][!DisableMeasure "MeasureEatTopTextChars"][!UpdateMeasure "MeasureEatTopTextChars"]
IfNotMatchAction=[!SetOption MeasureEatTopTextChars String "[MeasureEatTopTextChars]"][!SetOption TopText Text "[MeasureEatTopTextChars]"][!UpdateMeter "TopText"]
IfMatchMode=1
DynamicVariables=1

[MeasureEatBottomTextChars]
Disabled=1
Measure=String
String=""
UpdateDivider=(#EatCharUpdate#/50)
RegExpSubstitute=1
Substitute="^.{1}(.*)$":"\1","^\\1$":""
IfMatch=^$
IfMatchAction=[!SetOption BottomText Text ""][!UpdateMeter "BottomText"][!DisableMeasure "MeasureEatBottomTextChars"][!UpdateMeasure "MeasureEatBottomTextChars"]
IfNotMatchAction=[!SetOption MeasureEatBottomTextChars String "[MeasureEatBottomTextChars]"][!SetOption BottomText Text "[MeasureEatBottomTextChars]"][!UpdateMeter "BottomText"]
IfMatchMode=1
DynamicVariables=1

; =================================================
; Meters

[Background]
Meter=Image
X=0
Y=0
W=((#skinSize# > #lastSetWidth#) ? (#skinSize#+(#skinSize#*0.35)) : (#lastSetWidth#+(#skinSize#*0.35)))
H=(#skinSize#*0.25)
SolidColor=0,0,0,1
DynamicVariables=1
Group=Visible

[Now]
Meter=String
Text=Now
StringCase=Upper
StringAlign=#interfaceTextAlignment#
FontSize=(#skinSize#*0.03)
FontColor=#opaque#
X=#nowTextPositionHor#
Y=(#skinSize#*0.09)
AntiAlias=1
FontFace=#controlsFont#
UpdateDivider=-1
Hidden=#stowAway#
Group=Stow | Visible

[Playing]
Meter=String
Text=Playing
StringCase=Upper
StringAlign=#interfaceTextAlignment#
FontSize=(#skinSize#*0.03)
FontColor=#opaque#
X=r
Y=(#skinSize#*0.125)
AntiAlias=1
FontFace=#controlsFont#
UpdateDivider=-1
Hidden=#stowAway#
Group=Stow | Visible

[Hairline]
Meter=Bar
MeasureName=mProgress#MusicSwitch#P
X=#hairlinePositionHor#
W=(#skinSize#*0.005)
H=(#skinSize#*0.25)
BarColor=#over#
SolidColor=#opaque#
BarOrientation=Vertical
ToolTipText="Progress Bar"
UpdateDivider=4
Hidden=#stowAway#
Group=Stow | Visible

[MeterContainer]
Meter=Image
SolidColor=0,0,0,255
X=#topTextPositionHor#
Y=(#skinSize#*0.14-60)
W=#Width#
H=104

[IntegralTopText]
Container=MeterContainer
Meter=String
MeterStyle=styleTextMajor
FontFace=#thinFont#
FontColor=0,0,0,0
StringAlign=Left
X=0
Y=(#skinSize#/10)
Text="[#topText##MusicSwitch#]"
OnUpdateAction=[!SetVariable IntegralTopTextWidth [IntegralTopText:W]]
DynamicVariables=1

[IntegralBottomText]
Container=MeterContainer
Meter=String
MeterStyle=styleTextMajor
FontFace=#thickFont#
FontColor=0,0,0,0
StringAlign=Left
X=0
Y=R
Text="[#bottomText##MusicSwitch#]"
OnUpdateAction=[!SetVariable IntegralBottomTextWidth [IntegralBottomText:W]]
DynamicVariables=1

[TopText]
Meter=String
MeterStyle=styleTextMajor
X=(#IntegralTopTextWidth#-[MeasureScroll])
Y=[IntegralTopText:Y]
ClipStringW=#Width#
ClipStringH=(#skinSize#/10)
ClipString=0
FontFace=#thinFont#
Text="[#topText##MusicSwitch#]"
StringAlign=Right
Container=MeterContainer
OnUpdateAction=[!SetVariable TopTextWidth [TopText:W]]
DynamicVariables=1

[BottomText]
Meter=String 
MeterStyle=styleTextMajor
X=(#IntegralBottomTextWidth#-#IntegralTopTextWidth#)r
Y=R
ClipStringW=#Width#
ClipStringH=(#skinSize#/10)
ClipString=0
FontFace=#thickFont#
Text="[#bottomText##MusicSwitch#]"
StringAlign=Right
Container=MeterContainer
OnUpdateAction=[!SetVariable BottomTextWidth [BottomText:W]]
DynamicVariables=1

[Time]
Meter=STRING
MeterStyle=styleTextMini
MeasureName=mPosition#MusicSwitch#
MeasureName2=mLength#MusicSwitch#
X=#nowTextPositionHor#
Y=(#skinSize#*0.02)
Text="%1/%2"
UpdateDivider=4

[Progress]
Meter=String
MeterStyle=styleTextMini
MeasureName=mProgress#MusicSwitch#W
X=r
Y=(#skinSize#*0.0465)
Text="%1%"

[Play]
MeterStyle=styleTextControls
Meter=String
MeasureName=mStateButton#MusicSwitch#
X=#playCtrlPositionHor#
Y=(#skinSize#*0.2)
Text="%1"
LeftMouseUpAction=!CommandMeasure "m#playerController#" "PlayPause"
UpdateDivider=4
SolidColor=0,0,0,1

[Previous]
MeterStyle=styleTextControls
Meter=String
X=#nowTextPositionHor#
Y=(#skinSize#*0.17)
Text="previous"
LeftMouseUpAction=!CommandMeasure "m#playerController#" "Previous"
UpdateDivider=-1

[Next]
MeterStyle=styleTextControls
Meter=String
X=#nowTextPositionHor#
Y=(#skinSize#*0.2)
Text="next"
LeftMouseUpAction=!CommandMeasure "m#playerController#" "Next"
UpdateDivider=-1
SolidColor=0,0,0,1

[Settings]
Meter=String
MeterStyle=styleTextMini
FontColor=#translucent#
X=#settingsTextPositionHor#
Y=(#skinSize#*0.0465)
Text="settings"
MouseActionCursor=1
LeftMouseUpAction=!ActivateConfig "Cleartext\Settings"
UpdateDivider=-1
Drawbacks:
- for some reason, the artist and title show up starting with the 2nd "row" in the skin - I'm not sure why this happens or whether there are things on the 3rd "row" that are messed by this behavior. I suppose it could be corrected by changing the Y, but I don't want to do things without first understand why the issue happens in the first place
- the scroll doesn't start exactly at position "0", but adds one instance of #Speed# right from the start (the issue with counters starting at 0, balala knows)
- there aren't any "pauses" before the scroll or the char eating, so there are small chances to see the text for longer before it starts the animation

Maybe balala can help with these drawbacks, hopefully. There is 95% of the things that are done in this version, but some pauses before starting with the 2 animations would really help, visually. I'm not entirely sure a [!Delay ...] bang would be the most appropriate in this case (there are some minor artefacts when trying that - although they're not that serious, and could be considered "additional effects" if one is lenient).
Hmm so, I tried this, the text dosn't exactly show up correctly, I tried to remove the bound box, It seems to work correct, just not in the correct location... I would recon it's an easy fix but my limited knowledge dosn't know how to move things on the XY (I tried + and - 100 but nothing moved in top text or bottom text)
https://drive.google.com/open?id=1vEHM8i0OuHQsgIiK5odzLGqKdGHr_kmY
Crash
Posts: 47
Joined: February 12th, 2020, 1:53 am

Re: Scrolling text

Post by Crash »

balala wrote: April 8th, 2020, 7:10 pm I'm surprised, because it does for me:
GIF.gif
Tried just to test, and got the same outcome, text appears but no scroll occurs
User avatar
Yincognito
Rainmeter Sage
Posts: 7522
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Scrolling text

Post by Yincognito »

Crash wrote: April 8th, 2020, 7:17 pm Hmm so, I tried this, the text dosn't exactly show up correctly, I tried to remove the bound box, It seems to work correct, just not in the correct location... I would recon it's an easy fix but my limited knowledge dosn't know how to move things on the XY (I tried + and - 100 but nothing moved in top text or bottom text)
https://drive.google.com/open?id=1vEHM8i0OuHQsgIiK5odzLGqKdGHr_kmY
What do you mean by this? It is showing too left, too right, too upwards or downwards? (<-- don't pay attention to this, I saw where the text was by looking more closely at your screenshot). By the way, I only tested this with the design with Now Playing on the left (text aligned to the left in Settings, if I recall correctly). If I'm not mistaken, you use a different setup - but I saw in the earler posts that you didn't mind having it positioned the way I worked, so I didn't bother to test it any other way.

For me, it works (bar the drawbacks I mentioned): Preview

P.S. That being said, the skin is not exactly simple, and there are lots of dependencies in it, so one cannot be entirely sure it will work for all situations...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7522
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Scrolling text

Post by Yincognito »

balala wrote: April 8th, 2020, 7:10 pm I'm surprised, because it does for me:
GIF.gif
I believe you. As I said, there are a lot of settings one can do in that skin, so maybe something different in the settings is causing a different behavior - who knows?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7522
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Scrolling text

Post by Yincognito »

Ok, just re-tested it. I downloaded the skin from the link I posted here, made absolutely no modifications in the settings except setting the "media player" to Winamp (which I use, and I used during the whole skin rewriting process), copy pasted my last posted code in Cleartext.ini replacing the original, played a song and hit refresh on the skin and it worked - just like the last time when trying.

I doubt that setting a different player would produce radically different results, but you never know. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16342
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Scrolling text

Post by balala »

Crash wrote: April 8th, 2020, 7:29 pm Tried just to test, and got the same outcome, text appears but no scroll occurs
Is the title shown, beside the artist?
Are you sure you added the OnChangeAction option to the [mTitle0] measure in the Cleartext\@Resources\base.ini file?
balala wrote: April 8th, 2020, 6:09 pm So, first you have to add an OnChangeAction option to the Cleartext\@Resources\base.ini file. Add it to its [mTitle0] measure: OnChangeAction=[!CommandMeasure "MeasureTitleIn" "Execute 1"][!SetVariable Step "0"][!UpdateMeasure "MeasureTitleSc"][!Redraw]
If you are and still can't get it to work, I'm gonna pack the config tomorrow (here is almost midnight) and gonna upload it here. Just first make sure the OnChangeAction is added, please and let me know.
User avatar
Yincognito
Rainmeter Sage
Posts: 7522
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Scrolling text

Post by Yincognito »

balala wrote: April 8th, 2020, 8:52 pmIs the title shown, beside the artist?
Are you sure you added the OnChangeAction option to the [mTitle0] measure in the Cleartext\@Resources\base.ini file?
This fixed it for me - my bad, this time I was the one not paying attention to the details in your post explaining this. Both the artist and the title are shown (of course, with the artist not scrolling if bigger than the container, which you already mentioned). One problem though: sometimes, only a part of the title is shown. On a subsequent attempt though, the entire title is shown and all is ok.

P.S. By the way, an OnChangeAction in base.ini's [mTitle0] won't accurately detect when the song is changed (I think this was the purpose of it - to start the animation on song change). You might want to take a look at [mLastTexts] and [mTexts] from my code (most of those bangs have no relevance if placed in your code, except the ones updating [mLastTexts]), for a more accurate (but not perfect, of course) way to detect this (and start the animation accordingly). Too bad the NowPlaying measure doesn't have a way to "internally" provide when the song has been changed from the player...

EDIT: Your version is definitely better than mine, since it scrolls over and over. :thumbup: I liked the way you used Log() to calculate the length of the title in chars, although probably easier would have been to convert every char (.) to 1+, deleting the last + and then similarly using a Calc measure on the modified string to get its numerical string length.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Crash
Posts: 47
Joined: February 12th, 2020, 1:53 am

Re: Scrolling text

Post by Crash »

balala wrote: April 8th, 2020, 8:52 pm Is the title shown, beside the artist?
Are you sure you added the OnChangeAction option to the [mTitle0] measure in the Cleartext\@Resources\base.ini file?

If you are and still can't get it to work, I'm gonna pack the config tomorrow (here is almost midnight) and gonna upload it here. Just first make sure the OnChangeAction is added, please and let me know.
Still can't get it to work, I made sure to add it...
I also don't see the artist name ther either...
User avatar
Yincognito
Rainmeter Sage
Posts: 7522
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Scrolling text

Post by Yincognito »

Crash wrote: April 8th, 2020, 9:57 pm Still can't get it to work, I made sure to add it...
I also don't see the artist name ther either...
I only managed to not see the artist in balala's version if I set the Text Alignment to Right in the Settings skin - setting it to Left made things work (similar to the effect on my version). That being said, it is possible (though not that likely) that the skin works differently with iTunes (I don't know which player did balala used to test his version).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth