It is currently July 21st, 2019, 9:35 am

avoid: square brackets in variables

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

avoid: square brackets in variables

moshi » September 8th, 2013, 11:35 pm

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: 19301
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: avoid: square brackets in variables

jsmorley » September 9th, 2013, 1:40 am

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.