It is currently April 26th, 2024, 10:00 am

Relative Positioning of String to stick together closer.

Get help with creating, editing & fixing problems with skins
User avatar
thefallenyogurt
Posts: 9
Joined: December 24th, 2016, 1:52 pm

Relative Positioning of String to stick together closer.

Post by thefallenyogurt »

Image


How do I make this such that the album name (bottom) is always sticking close to the title of the song. For example the title could go on to the next line and then the album name is just below it there because Y=0R (Note that the light red box is the bounded area of the text) . But it should also be close together to it when the title is just one line long as well. Please help.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Positioning of String to stick together closer.

Post by jsmorley »

Why not just print them in the same meter?

[MeasureSomeSong]
Measure=Whatever

[MeasureSomeAlbum]
Measure=Whatever

[MeterSongAlbum]
Meter=String
MeasureName=MeasureSomeSong
MeasureName2=MeasureSomeAlbum
Text=%1#CRLF#%2

If you want the format different, you can do that as well, using InlineSetting.

Just use regular expressions like:

InlinePattern=^(.*)#CRLF#.*$
inlinePattern2=^.*#CRLF#(.*)$
User avatar
thefallenyogurt
Posts: 9
Joined: December 24th, 2016, 1:52 pm

Re: Relative Positioning of String to stick together closer.

Post by thefallenyogurt »

jsmorley wrote:Why not just print them in the same meter?

[MeasureSomeSong]
Measure=Whatever

[MeasureSomeAlbum]
Measure=Whatever

[MeterSongAlbum]
Meter=String
MeasureName=MeasureSomeSong
MeasureName2=MeasureSomeAlbum
Text=%1#CRLF##2
Thank you for the reply.
Can you explain the Text=%1#CRLF##2 part.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Positioning of String to stick together closer.

Post by jsmorley »

Code: Select all

[MeasureSong]
Measure=String
String=Layla

[MeasureAlbum]
Measure=String
String=Derek and the Dominos

[MeterOne]
Meter=String
MeasureName=MeasureSong
MeasureName2=MeasureAlbum
InlineSetting=Size | 15
InlinePattern=^(.*)#CRLF#.*$
InlineSetting2=Size | 12
InlinePattern2=^.*#CRLF#(.*)$
Text=%1#CRLF#%2
AntiAlias=1
1.png
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Positioning of String to stick together closer.

Post by jsmorley »

thefallenyogurt wrote:Thank you for the reply.
Can you explain the Text=%1#CRLF##2 part.
Sure, when you use MeasureName, MeasureName2 ... you can then use "tokens" of %1, %2... in the Text option of the meter to represent those values. This allows you to concatenate multiple measure values into a single String meter. The #CRLF# is simply a built-in variable that represents a "carriage return / linefeed".

Sorry for the typo before. It should be:

Text=%1#CRLF#%2
User avatar
thefallenyogurt
Posts: 9
Joined: December 24th, 2016, 1:52 pm

Re: Relative Positioning of String to stick together closer.

Post by thefallenyogurt »

jsmorley wrote:Sure, when you use MeasureName, MeasureName2 ... you can then use "tokens" of %1, %2... in the Text option of the meter to represent those values. This allows you to concatenate multiple measure values into a single String meter. The #CRLF# is simply a built-in variable that represents a "carriage return / linefeed".

Sorry for the typo before. It should be:

Text=%1#CRLF#%2
Image

I copy pasted your code without understanding it too much as I haven't dived deep into Rainmeter yet. But now to just complete this, I am confused as where to set the ClipString option to for the top and the bottom text. What do I do that the Title remains within the light red bounding box? I want the top text to be clipped at a Width of 235 and a height of 50. And the album text to be clipped at 235 as well and height of 25.
Last edited by thefallenyogurt on December 24th, 2016, 3:12 pm, edited 1 time in total.
User avatar
thefallenyogurt
Posts: 9
Joined: December 24th, 2016, 1:52 pm

Re: Relative Positioning of String to stick together closer.

Post by thefallenyogurt »

Also is it valid to use the Font Color in the inlinepattern? ( I'm sorry I have no idea what it is :???: )


Image
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Positioning of String to stick together closer.

Post by jsmorley »

You can use all kinds of formatting features in Inline Options.

https://docs.rainmeter.net/manual-beta/meters/string/inline/

However, to have distinct ClipString settings on each part of the values, the song title and album title, then you would need separate meters, like you had before. Then it gets trickier to get them to position relative to each other. If you simply use ClipString=1, a W (width) but no H (height) the value will display on a single line clipped at W. Then using Y=0R on the next meter would position it right under. If you want it to "wrap" though, then you have to set an H, and that won't be variable. It will always be H tall, and any meter under it will have extra spacing between if the first value isn't long enough to wrap to fill the height.
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Relative Positioning of String to stick together closer.

Post by jsmorley »

You could use ClipString=2 and ClipStringH to set a "maximum" height, while not forcing a particular height.

Code: Select all

[MeterOne]
Meter=String
MeasureName=MeasureSong
InlineSetting=Size | 15
W=150
ClipString=2
ClipStringH=45
AntiAlias=1

[MeterTwo]
Meter=String
MeasureName=MeasureAlbum
Y=0R
InlineSetting=Size | 12
W=150
ClipString=2
ClipStringH=45
AntiAlias=1
https://docs.rainmeter.net/manual-beta/meters/string/#ClipString

https://docs.rainmeter.net/manual-beta/meters/string/#ClipStringH
User avatar
thefallenyogurt
Posts: 9
Joined: December 24th, 2016, 1:52 pm

Re: Relative Positioning of String to stick together closer.

Post by thefallenyogurt »

jsmorley wrote:You can use all kinds of formatting features in Inline Options.

https://docs.rainmeter.net/manual-beta/meters/string/inline/

However, to have distinct ClipString settings on each part of the values, the song title and album title, then you would need separate meters, like you had before. Then it gets trickier to get them to position relative to each other. If you simply use ClipString=1, a W (width) but no H (height) the value will display on a single line clipped at W. Then using Y=0R on the next meter would position it right under. If you want it to "wrap" though, then you have to set an H, and that won't be variable. It will always be H tall, and any meter under it will have extra spacing between if the first value isn't long enough to wrap to fill the height.

Okay, What if I apply the clip string option to the Single meter you just showed me? and also how do I use multiple formatting options for a single line for InlineSetting?