It is currently April 25th, 2024, 4:43 am

avoid: square brackets in variables

Tips and Tricks from the Rainmeter Community
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

avoid: square brackets in variables

Post by moshi »

i just noticed that this post:

http://rainmeter.net/forum/viewtopic.php?p=91909#p91909
Re: [app] Skins on Taskbar Thumbnail Live Previews (Win7) [W

broke one of my feed reader skins. at least !SetVariable did no longer work. i am not sure wether it was the square brackets, or just the open square bracket at the end.

can be avoided by substituting square brackets with fullwidth Asian square brackets (unicode)

Code: Select all

RegExpSubstitute=1
Substitute="\[":"[","\]":"]"
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: avoid: square brackets in variables

Post by jsmorley »

moshi wrote:i just noticed that this post:

http://rainmeter.net/forum/viewtopic.php?p=91909#p91909
Re: [app] Skins on Taskbar Thumbnail Live Previews (Win7) [W

broke one of my feed reader skins. at least !SetVariable did no longer work. i am not sure wether it was the square brackets, or just the open square bracket at the end.

can be avoided by substituting square brackets with fullwidth Asian square brackets (unicode)

Code: Select all

RegExpSubstitute=1
Substitute="\[":"[","\]":"]"
Yeah, it is the open bracket without a close that is doing it.

Code: Select all

[Variables]
MyVar=[OldVar]

[MeterOne]
Meter=String
FontSize=13
FontColor=255,255,255,255
SolidColor=60,60,60,255
Padding=5,5,5,5
Text=#MyVar#
LeftMouseUpAction=[!SetVariable MyVar "[NewVar]"][!UpdateMeter *][!Redraw]
DynamicVariables=1
Works fine: Displays [NewVar]

Code: Select all

[Variables]
MyVar=[OldVar]

[MeterOne]
Meter=String
FontSize=13
FontColor=255,255,255,255
SolidColor=60,60,60,255
Padding=5,5,5,5
Text=#MyVar#
LeftMouseUpAction=[!SetVariable MyVar "[NewVar] ["][!UpdateMeter *][!Redraw]
DynamicVariables=1
Fails: Stays as [OldVar]

Code: Select all

LeftMouseUpAction=[!SetVariable MyVar "[NewVar] []"][!UpdateMeter *][!Redraw]
Goes back to working...

Sort of a bug really, but not sure what can be done in the short-term given the hideously complicated parsing already done with variables and section variables. The Substitute is certainly an "out" in the meantime.