It is currently April 26th, 2024, 4:24 am

String Manipulation

Get help with creating, editing & fixing problems with skins
Chris.Miller
Posts: 1
Joined: August 5th, 2010, 1:50 pm

String Manipulation

Post by Chris.Miller »

Hi rather new to rainmeter.
I recently downloaded Spotify Control by Poiru which allows raimeter to switch which track spotify plays,

Code: Select all

http://poiru.deviantart.com/art/Spotify-Control-169879876
and decided to make a music skin. but I have a problem. When measuring the track info spotify returns it in the format "SPOTIFY - ARTIST – TRACK" in one string. and in the skin I want to have the Artist and Track in different places. so I need to split the string into 2 strings of artist and track. I've spent a bit of time searching and I thought that REGEXP function was my best bet,
so I tried the code

Code: Select all

[MeasureTrack]
Measure=Plugin
Plugin=Plugins\WindowMessagePlugin.dll
WindowClass=SpotifyMainWindow
RegExp="(U)–(.*).*"
Debug=1 

[MeasureArtist]
Measure=Plugin
Plugin=Plugins\WindowMessagePlugin.dll
WindowClass=SpotifyMainWindow
RegExp="(U)Spotify - (.*) – "

I think its worth pointing out here that the "-" after "SPOTIFY -" is a different symbol to the "–" between the Artist and Track
needless to say this didn't work which is why I'm here. have I made a mistake? or will regexp only work with WebParser? and if regexp wont work is there another way I could split this string up?

Thanks.
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: String Manipulation

Post by Alex2539 »

RegExp is only used with WebParser. It is a feature of the plugin, not Rainmeter. The only way to split up the string would be to somehow output it to a file and then use WebParser to read and parse that file.
ImageImageImageImage
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: String Manipulation

Post by poiru »

Chris.Miller wrote:if regexp wont work is there another way I could split this string up?
You could use something like this:

Code: Select all

Subsitute="Spotify - ":""," - ":"#CRLF#"
The #CRLF# variable inserts a line break so, you the output would be:

Code: Select all

ARTIST
TRACK