It is currently October 14th, 2019, 6:55 am

Running string

Tips and Tricks from the Rainmeter Community
User avatar
balala
Rainmeter Sage
Posts: 8799
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Running string

balala » October 21st, 2012, 6:58 pm

Recently I was looking for a way to show a runing text. I wanted to this string appear on the right side of the skin and goes to left, up to the side of the skin. Since I didn't found in this forum a this kind of solution, I have created it myself and I'd like to present it, if somebody needs it. If it already have been presented, please forgive me.
So, here is the skin:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextWidth=45
SkinWidth=100
Txt=Hello

;----------------------------------------

[MeterText]
Meter=String
X=[MeasureX]
Y=3
W=[BinActionWidth]
H=25
FontColor=200,200,200
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Txt#
Hidden=1
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
Some explanations:
- Use a short update, I used 100. If not, the movement will not be smoth enough.
- TextWidth and SkinWidth are the width of the text and skin. Since I didn't used a background the last one must be setted. Setting SkinWidth is simple: it depend on you. Setting TextWidth determines the amount of pause betwean exit and reentry of the string: if you find the real width of the string (in pixels) immediately after the string goes out on left, it will strat to enter on the right.
- The [MeasureTimer] section is a counter which is increasing at every update.
- Acording to it's value, the [MeasureX] value will define the string's position. If the string isn't completely out from the skin's width, then it's position moves at left at every update. In other case it become double of skin's total width, because in this case the string went out from the skin and the whole process must be reseted (by [BinActionRefresh] section).
- The width of the visible part of the string will be determined by [BinActionWidth] section. Near the margins this width must be increase (when the string enter) and decrease (when it goes out).
The great inconvenient of this skin is that must be determined the more accurately the width of the text. I couldn't find a better way.
Please post comments about how this skin works for you and if you find it good enough or if you can improve it. Any comment would be welcomed.
Alex Becherer

Re: Running string

Alex Becherer » October 21st, 2012, 8:36 pm

nice :)
i was using a similar approach here: http://customize.org/rainmeter/skins/90732
User avatar
XANCI
Posts: 106
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Re: Running string

XANCI » October 22nd, 2012, 5:27 am

Simply moving the string looks nice but only apply from edge to edge
User avatar
Naruto
Posts: 47
Joined: December 8th, 2012, 8:05 pm
Location: Egypt

Re: Running string

Naruto » December 11th, 2012, 7:42 pm

What is i want the running text to be vertical ?
I tried this but didn't work

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextHeight=45
SkinHeight=110
Txt=Naruto

;----------------------------------------

[MeterText]
Meter=String
X=3
Y=[MeasureY]
W=25
H=[BinActionHeight]
FontColor=000000FF
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=FFFFFFFF
StringStyle=BOLD
;StringAlign=LEFT
Angle=1.57
AntiAlias=1
Text=#Txt#
Hidden=1
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureY]
Measure=Calc
Formula=(( MeasureY < ( -1 * #TextHeight# )) ? ( 2 * #SkinHeight# ) : ( #SkinHeight# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureY
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinHeight# )

[BinActionHeight]
Measure=Calc
Formula=((( #SkinHeight# - MeasureY ) < #TextHeight# ) ? ( #SkinHeight# - MeasureY ) : #TextHeight# )
User avatar
balala
Rainmeter Sage
Posts: 8799
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running string

balala » December 11th, 2012, 9:02 pm

A very simple approach:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextWidth=36
SkinWidth=100
Txt=Hello

;----------------------------------------

[MeterText]
Meter=String
X=3
Y=[MeasureX]
W=50
H=[BinActionWidth]
FontColor=200,200,200
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Txt# 
Hidden=1
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
I made the only change in [MeterText] section, moving [MeasureX] from X to Y and [BinActionWidth] from W to H. I also changed the value of TextWidth variable. Maybe you could play with the values of TextWidth and SkinWidth, or change the words Width with Height and X with Y along the entire skin, but this is just a simple game and has importance if you start to work with you skin later.
Please let me know, if this was what you wanted to achieve.
User avatar
Naruto
Posts: 47
Joined: December 8th, 2012, 8:05 pm
Location: Egypt

Re: Running string

Naruto » December 12th, 2012, 1:19 pm

balala wrote:A very simple approach:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextWidth=36
SkinWidth=100
Txt=Hello

;----------------------------------------

[MeterText]
Meter=String
X=3
Y=[MeasureX]
W=50
H=[BinActionWidth]
FontColor=200,200,200
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Txt# 
Hidden=1
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
I made the only change in [MeterText] section, moving [MeasureX] from X to Y and [BinActionWidth] from W to H. I also changed the value of TextWidth variable. Maybe you could play with the values of TextWidth and SkinWidth, or change the words Width with Height and X with Y along the entire skin, but this is just a simple game and has importance if you start to work with you skin later.
Please let me know, if this was what you wanted to achieve.

mmm good but that i did already what i want most is to make the text also vertical like this
Image
and make it move like u just did(vertically).
User avatar
balala
Rainmeter Sage
Posts: 8799
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running string

balala » December 12th, 2012, 7:03 pm

Look at this:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextWidth=130
SkinWidth=400
Txt=Naruto

;----------------------------------------

[MeterText]
Meter=String
X=25
Y=[MeasureX]
W=50
H=[BinActionWidth]
FontColor=200,200,200
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Txt# 
Hidden=1
Angle=1.5707963267948966192313216916398
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
You must edit the two variables:
TextWidth - Set this variable acording to the length of your text. If you set a small value, the text won't be visible entirely.
SkinWidth - If you set a higher value, the text will make a longer path.
Once again, let me know if this is what you wanted.
User avatar
Naruto
Posts: 47
Joined: December 8th, 2012, 8:05 pm
Location: Egypt

Re: Running string

Naruto » December 13th, 2012, 4:30 pm

Thank you @balala it works and here is the skin:

Code: Select all

[Metadata]
Name=Running string
Description=Demonstrate how can be created a running string

[Rainmeter]
Author=balala (blaci75@gmail.com)
OnRefreshAction=!execute [!RainmeterShowMeter MeterText]
Update=100
MouseActionCursor=1

[Variables]
TextWidth=165
SkinWidth=150
Txt=Naruto Desktop

;----------------------------------------

[MeterText]
Meter=String
X=25
Y=[MeasureX]
W=50
H=[BinActionWidth]
FontColor=0,0,0
FontSize=16
FontFace=Stagnation BRK
FontEffectColor=FFFFFFFF
StringStyle=BOLD
StringAlign=LEFT
StringEffect=SHADOW
AntiAlias=1
Text=#Txt#
Hidden=1
Angle=1.5707963267948966192313216916398
DynamicVariables=1

[MeasureTimer]
Measure=Calc
Formula=( MeasureTimer + 1 )

[MeasureX]
Measure=Calc
Formula=(( MeasureX < ( -1 * #TextWidth# )) ? ( 2 * #SkinWidth# ) : ( #SkinWidth# - MeasureTimer ))

[BinActionRefresh]
Measure=Calc
Formula=MeasureX
IfEqualAction=!Refresh
IfEqualValue=( 2 * #SkinWidth# )

[BinActionWidth]
Measure=Calc
Formula=((( #SkinWidth# - MeasureX ) < #TextWidth# ) ? ( #SkinWidth# - MeasureX ) : #TextWidth# )
User avatar
balala
Rainmeter Sage
Posts: 8799
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running string

balala » December 13th, 2012, 5:20 pm

OK, I'm glad if I could help.
User avatar
Naruto
Posts: 47
Joined: December 8th, 2012, 8:05 pm
Location: Egypt

Re: Running string

Naruto » August 13th, 2015, 12:19 am

Can you please make it go in the reverse direction (moving horizontally from left to right), i am not good around equations and math?