It is currently July 20th, 2019, 8:55 pm

a scrolling ticker

Tips and Tricks from the Rainmeter Community
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

a scrolling ticker

moshi » August 29th, 2013, 12:38 pm

here's a way to scroll text using substitutions and !SetVariable:

Code: Select all

[Rainmeter]
AccurateText=1
Update=150
DynamicWindowSize=1

[Variables]
AudioPlayer=winamp
Text=

[MeasureAudioPlayerTitle]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=#AudioPlayer#
PlayerType=Title
Substitute="":" this is a scrolling ticker. you better use a monospaced font."
OnChangeAction=[!SetVariable Text " [MeasureAudioPlayerArtist][MeasureAudioPlayerTitle]"]

[MeasureAudioPlayerArtist]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=[MeasureAudioPlayerTitle]
PlayerType=Artist
RegExpSubstitute=1
Substitute="^(.+)$":"\1 - "

[Calc1]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#Text#","^.(.*)$":"\1"
OnUpdateAction=[!SetVariable Text "[Calc1]"]

[Calc2]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#Text#","^(...................).*$":"\1"

[Calc3]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#Text#","^(.+)$":"1","^$":"0"

[Calc4]
Measure=Calc
Formula=([Calc3])
DynamicVariables=1
IfEqualValue=0
IfEqualAction=[!SetVariable Text " [MeasureAudioPlayerArtist][MeasureAudioPlayerTitle]"]

[MeterTitle]
Meter=String
Text="[Calc2]"
FontColor=ffffff
FontSize=20
FontFace=Consolas
DynamicVariables=1
Antialias=1
StringStyle=Bold
SolidColor=00000001
User avatar
Dank420
Posts: 147
Joined: April 3rd, 2013, 1:04 am
Location: O-High-O

Re: a scrolling ticker

Dank420 » August 29th, 2013, 9:33 pm

id thought about this(but dont have the skill) love it...
shaved 5 to 8% off cpu useing this instead of Scrolling marquee lua
and speed changeable with update .. BUEATY.....
User avatar
moshi
Posts: 1851
Joined: November 13th, 2012, 9:53 pm

Re: a scrolling ticker

moshi » August 30th, 2013, 8:00 am

you could also try this:

Code: Select all

[Calc2]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#Text# [MeasureAudioPlayerArtist][MeasureAudioPlayerTitle]","^(...................).*$":"\1"
User avatar
iNjUST
Posts: 118
Joined: June 20th, 2012, 12:44 am

Re: a scrolling ticker

iNjUST » September 1st, 2013, 7:26 am

Very cool, thanks for the tip!

Not to steal your thunder, but here's a slightly optimized version:

Code: Select all

[Rainmeter]
Update=200

[Variables]
; Initial Text (modify based on your Measures and preferences)
InitText="[mTitle] by [mArtist] from [mAlbum]"
; Set the Ticker Text to the initial value to begin
TickText=#InitText#
; Text between repetitions of the ticker
GapText="........."
; Number of characters to display
NumChar=16

[mTitle]
; I won't include all of this.
[mArtist]
; Use the NowPlaying doc page...
[mAlbum]
; if you don't know what this is.

[cText1]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#TickText#","^.(.*)$":"\1","^$":"#GapText# #InitText#"
OnUpdateAction=[!SetVariable TickText "[cText1]"]

[cText2]
Measure=Calc
Formula=1
DynamicVariables=1
RegExpSubstitute=1
Substitute="1":"#TickText# #GapText# #InitText#","^(.{#NumChar#}).*$":"\1"

I'll be using this in an upcoming skin, so I'll give you some credit when I post it for the initial idea!