It is currently September 15th, 2019, 9:01 pm

String manipulation

Help with creating, editing & fixing problems with skins
RainyDayBlues
Posts: 2
Joined: September 13th, 2019, 9:22 am

String manipulation

RainyDayBlues » September 13th, 2019, 9:45 am

I have a measure that returns a version value (extracted from a filename, C:\MyPath\ReadMe Rev01.doc), but I want the meter to display the value, 'Rev01' or 'None' fixed text if the version is blank
To do this, I thought I'd use a string measure to process the value obtained, with a RegEx substitute ("^$":"none") but I can't get even the basic string to work.

My measureVersion is either blank or the version text, Rev01, and I can display that in a meter

Code: Select all

[measureReadMe]
Measure=Plugin
Plugin=FileView
Path="C:\MyPath"
ShowDotDot=0
ShowFolder=0
WildcardSearch="ReadMe *.doc"
HideExtensions=1
Count=1
[measureVersion]
Measure=Plugin
Plugin=FileView
Path=[measureReadMe]
Type=Filename
Index=1
Substitute="ReadMe ":""
[measureVersionOrNone]
Measure=String
String=[measureVersion]
If I set the meter to display measureVersion it works, but if I set it to display measureVersionOrNone it is always blank.
If I use String=A[measureVersion]A the meter displays AA

Any ideas?
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: String manipulation

jsmorley » September 13th, 2019, 10:27 am

If you are going to use that [MeasureVersionOrNone] String measure, then you will need DynamicVariables=1 on it to use the [SectionVariable] as the string value.

However, you don't really need that measure in my view...

Code: Select all

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

[MeasureReadMe]
Measure=Plugin
Plugin=FileView
Path="C:\MyPath"
ShowDotDot=0
ShowFolder=0
WildcardSearch="ReadMe *.doc"
HideExtensions=1
Count=1

[MeasureVersion]
Measure=Plugin
Plugin=FileView
Path=[MeasureReadMe]
Type=Filename
Index=1
RegExpsubstitute=1
Substitute="ReadMe ":"","^$":"None"

;[MeasureVersionOrNone]
;Measure=String
;String=[MeasureVersion]
;DynamicVariables=1

[MeterVersion]
Meter=String
MeasureName=MeasureVersion
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

1.jpg
You do not have the required permissions to view the files attached to this post.
RainyDayBlues
Posts: 2
Joined: September 13th, 2019, 9:22 am

Re: String manipulation

RainyDayBlues » September 13th, 2019, 10:45 am

That's fab, thanks. I had to split the substitutions on 2 lines tho, else it always showed None
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: String manipulation

jsmorley » September 13th, 2019, 10:46 am

RainyDayBlues wrote:
September 13th, 2019, 10:45 am
That's fab, thanks. I had to split the substitutions on 2 lines tho, else it always showed None
No, it shouldn't... I'm not even sure how you "split the substitutions".