Thanks for the clarification. I usually just use quotes to avoid possible issues.
So you are saying a path
variable, like #@#
, that contains spaces, will be resolved properly, even if not enclosed in quotes?
If so, then I do apologize for misinforming...
It will be resolved fine without quotes if used in an option
ImageName=#@#My Images\My Buttons\My First Button.png
However it would need quotes when used as a parameter in a bang, like:
LeftMouseUpAction=[!SetOption MyMeter ImageName "#@#My Images\My Buttons\My First Button.png"]
This is because a bang is made up of a bang name, and one or more required and optional parameters. In this case
!BangName SectionName OptionName OptionValue ConfigName
As you can see, the parameters themselves are delineated by spaces. It has to be able to properly "tear apart" the bang to set the correct parameters, and without quotes, spaces in any of them will totally confuse it.
Again, while it's kinda nitpicking since quotes almost can never hurt, the rules actually are:
Quotes are never needed around option values, spaces or not.
RegExp=(?siU)<Some Tag with Spaces>(.*)</Some Tag with Spaces>
BarImage=#@#Images\My Bars\My Red Bar.png
Text=Some text on a String meter
Quotes not needed on any of those...
Quote MAY be needed, and should always be used, on string parameters of any bang.
LeftMouseUpAction=[!SetOption MyBarMeter BarImage "#@#Images\My Bars\My Red Bar.png"]
LeftMouseUpAction=[!SetOption MyStringMeter Text "Some text on a String meter"]
LeftMouseUpAction=[!SetVariable MyColorVar "255,255,255,255"]
There are two exceptions.. Aren't there always.
The Substitute option
, while not needing any quotes to deal with spaces, requires as a component of how the option
works, that the elements of the Substitute are enclosed in quotes:
That has the effect of having starting and ending quotes on the option
value, but in this case they are not thrown away and ignored as with other options.
The Command and Parameter options on the RunCommand plugin may need stating and ending quotes, as the value itself may need to be quoted to work with Windows:
Note that we have two sets of "quotes" at the beginning and end. The first two are thrown away and ignored as usual, but then the second two are actually passed to Windows to properly execute a shell command that has spaces in it.
What if you need to have actual quotes in the value you are using in the parameter of a bang?
Text=This is a string with a "quoted bit" in it
How would you set that in a bang?
LeftMouseUpAction=[!SetOption MyStringMeter Text """This is a string with a "quoted bit" in it"""]
In this case, the quotes in the parameter itself can also cause confusion. The solution is to use """magic quotes""" which is how you tell Rainmeter that what follows is a string that itself contains quotes, and those embedded quotes should not be treated as beginning or ending a parameter.