It is currently April 23rd, 2024, 1:29 pm

[BUG or Mistake] Formula in String section variable?

Report bugs with the Rainmeter application and suggest features.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG or Mistake] Formula in String section variable?

Post by jsmorley »

Yincognito wrote: June 19th, 2020, 10:54 pm You're the man!! :great: :rosegift:
Didn't think of that - apparently it works for a long string with multiple measure and variable references:

Code: Select all

[!SetOption MT_Rainmeter_TooltipText Text """#LastArtist##CRLF#∆[\x200B] #LastAlbum#[\x200B]#CRLF#≡ #LastTitle##CRLF#● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●#CRLF#Player State    [MS_NowPlaying_State]   ●   Player Volume     [MS_NowPlaying_Volume][\x200B] %[\x200B]#CRLF#Track Length   #LastDuration#   ●   Track Progress    [MS_NowPlaying_Progress][\x200B] %[\x200B]#CRLF#Elapsed Time   [MS_NowPlaying_Position]   ●   Time Left      [MS_Rainmeter_TimeLeft]""" "#ROOTCONFIG#\Tooltip"]
By the way, would this work for the round bracket issue, maybe? :???:
I imagine so...
User avatar
Yincognito
Rainmeter Sage
Posts: 7149
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG or Mistake] Formula in String section variable?

Post by Yincognito »

jsmorley wrote: June 19th, 2020, 10:55 pm I imagine so...
That would be fantastic, even though I already got rid of the round brackets I used to set manually on no-value fields. :D But, as you said, I have no control over what the actual field looks like, and I have all kinds of funky characters in some file names / MP3 tags, and if a NowPlaying Title is something like (Like A Prayer) instead of Like A Prayer (just an example) I could be in trouble, LOL.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7149
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [BUG or Mistake] Formula in String section variable?

Post by Yincognito »

Ok, here's another one for you guys, which might stem from the same root issue...

Test skin:

Code: Select all

[Variables]
String=some"string
EscB=
Q=#EscB#"
Decoder="(?:#Q#)":"""
;Decoder="#Q#":"""

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[MeasureTest]
Measure=String
String=#String#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="#Decoder#"
DynamicVariables=1

---Meters---

[MeterTest]
Meter=STRING
X=0
Y=0
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
MeasureName=MeasureTest
Text="Test = %1"
DynamicVariables=1
Problem: watch the log, it's self explanatory
Details: no issues if the commented variable is used, despite being basically the same thing
Speculation: could this be because the Rainmeter parser is confusing this with a conditional due to the presence of variables and brackets?

So, what's the solution to this? I know the bits I posted don't make much sense from a logical point of view (i.e. replacing a quote with a quote), but I assure you it does in my code, and in the end I'm just trying to have a regex alternation (e.g. (?:a|b)) there instead of placing two comma separated substitution pairs (the latter of which works), for the sake of efficiency (i.e. regex parsing the string just once instead of twice).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth