It is currently April 25th, 2024, 3:51 am

Halp! String Wrapping!

Get help with creating, editing & fixing problems with skins
Couch3ater
Posts: 12
Joined: April 21st, 2015, 3:58 am
Location: Alexandria, VA

Halp! String Wrapping!

Post by Couch3ater »

Hello again all -- it's been a good while.

So yesterday I decided I was too lazy to switch from workspace to workspace in order to skip a track while listening to Spotify at work. Wound up using the NowPlaying plugin in conjunction with the Spotify plugin written by someone here on the forums (SORRY, forgot who :D)

Everything works as I'd like it to, save for the artist / track display. See this example:

Image

The long and short of it is that I would like for the track area to expand to fit longer track names. While the code that I have written seems to work, when the string is longer than the previously encountered "long track," the string clips. Refreshing the skin redraws the text, properly wrapping everything to a new line, so this leads me to believe my update is incorrect. That being said, I'm not certain what I would need to modify in order to achieve what I'm looking for. Would adding an Update to the track meter fix this? Seems to be related to redrawing and all...

I have included the relevant segments of code (IMO). At some point, the artist area will behave similarly, but for now, it appends ellipses at the end of the text. Quick, dirty, simple -- 'nuff said ;D

Code: Select all

[MeasureTrack]
	Measure=Plugin
	Plugin=SpotifyPlugin.dll
	Update=#whatever#
	Type=TrackName
	Substitute="":"Please come back later!"

[MeasureArtist]
	Measure=Plugin
	Plugin=SpotifyPlugin.dll
	Update=#whatever#
	Type=ArtistName
	Substitute="":"Spotify is closed"

...
	...
	...

[MeterArtist]
	Meter=String
	MeasureName=MeasureArtist
	X=80
	Y=40r
	W=150
	H=18
	FontFace=#fontName#
	FontColor=#fontColor#
	FontSize=12
	StringCase=UPPER
	StringAlign=Center
	ClipString=1
	AntiAlias=1
	Text="%1"
	SolidColor=0,0,0,1
	ToolTipText="Show Player"
	LeftMouseUpAction=#showSpotify#

[MeterTrack]
	Meter=String
	MeasureName=MeasureTrack
	X=80
	Y=20r
	W=100
	FontFace=#fontName#
	FontColor=#fontColor#
	FontSize=12
	StringAlign=Center
	Text="%1"
	SolidColor=0,0,0,1
	ToolTipText="Show Player"
	LeftMouseUpAction=#showSpotify#
	ClipString=2
Any help / insight would be greatly appreciated!

Thanks again!
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Halp! String Wrapping!

Post by FreeRaider »

I'm sure you've read this page, right?

By the way, I did not understand what you want, so can you give a concrete example?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Halp! String Wrapping!

Post by eclectic-tech »

You could add an OnChangeAction bang to [MeasureTrack] to have it update the meter [MeterTrack] when the track changes.

Code: Select all

[MeasureTrack]
   Measure=Plugin
   Plugin=SpotifyPlugin.dll
   Update=#whatever#
   Type=TrackName
   Substitute="":"Please come back later!"
   OnChangeAction=[!UpdateMeter MeterTrack][!Redraw]

Couch3ater
Posts: 12
Joined: April 21st, 2015, 3:58 am
Location: Alexandria, VA

Re: Halp! String Wrapping!

Post by Couch3ater »

FreeRaider wrote:I'm sure you've read this page, right?

By the way, I did not understand what you want, so can you give a concrete example?
=.=; Yes yes, I've read the string wrapping documentation. I feel like my original explanation should have led you to believe that I understood how the string wrapping worked!

Having said this, I believe eclectic-tech understood and answered my question. I'll keep you guys posted!
eclectic-tech wrote:You could add an OnChangeAction bang to [MeasureTrack] to have it update the meter [MeterTrack] when the track changes.
:O

I'll give this a try and will let you guys know if it works. I see no reason why it would not!

Thanks, eclectic!
Couch3ater
Posts: 12
Joined: April 21st, 2015, 3:58 am
Location: Alexandria, VA

Re: Halp! String Wrapping!

Post by Couch3ater »

Picked a few tracks with longer names, seemed to work okay. Let the radio go for about four hours with no issue.

Crisis averted. Thanks a ton, guys!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Halp! String Wrapping!

Post by eclectic-tech »

Glad to help! :cheers: