It is currently March 28th, 2024, 10:56 pm

[BUG] Quoting issue in 4.1 r2917 beta?

Report bugs with the Rainmeter application and suggest features.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

[BUG] Quoting issue in 4.1 r2917 beta?

Post by SilverAzide »

Hello,

There seems to be some sort of overly-aggressive de-quoting / parsing / whatever going on in the latest beta. I found a situation which used to work all the way back to RM 3.x days, but now no longer works without adding a ton of quotes.

Below is a simple skin to illustrate. The issue in particular are the two !SetOption bangs. They are now throwing an error, whereas they BOTH worked OK in all previous versions. (I'm a little surprised the second one worked, but that's a different topic maybe...)

There are 2 errors in the log with the latest beta:
!SetOption: Skin "C:\Program" not found
!SetOption: Skin "C:\TEMP\Whatever2.txt" not found


The issue can be resolved with lots of quoting, but my concern is that "lots of quoting" was not necessary before the latest beta.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
RunCommand=""C:\Program Files (x86)\Notepad++\notepad++.exe" {file}"
; removing outer quotes doesn't help
;RunCommand="C:\Program Files (x86)\Notepad++\notepad++.exe" {file}
; triple-quoting fixes both cases -- but was not required before the latest beta
;RunCommand=""""C:\Program Files (x86)\Notepad++\notepad++.exe" {file}"""
; ...or triple-quoting the !SetOption parameter instead of the variable (..."""[MeasureRunCommand1]""") also works

; the following worked as expected prior to the latest beta (quotes around measure name)
[MeasureRunCommand1]
Measure=String
String=#RunCommand#
Substitute="{file}":"C:\TEMP\Whatever1.txt"
IfCondition=1
IfTrueAction=[!SetOption MeterText1 LeftMouseUpAction "[MeasureRunCommand1]"]
UpdateDivider=-1

; surprisingly, the following worked too (no quotes around measure name)
[MeasureRunCommand2]
Measure=String
String=#RunCommand#
Substitute="{file}":"C:\TEMP\Whatever2.txt"
IfCondition=1
IfTrueAction=[!SetOption MeterText2 LeftMouseUpAction [MeasureRunCommand2]]
UpdateDivider=-1

[MeterText1]
Meter=String
MeasureName=MeasureRunCommand1
SolidColor=0,0,0
FontColor=255,255,255
Text="%1"

[MeterText2]
Meter=String
MeasureName=MeasureRunCommand2
SolidColor=128,0,0
FontColor=255,255,255
X=0r
Y=18r
Text="%1"
Gadgets Wiki GitHub More Gadgets...
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by SilverAzide »

P.S.: I don't mean to imply this is limited to the !SetOption bang, it happens with !SetVariable and perhaps everything else too.
Gadgets Wiki GitHub More Gadgets...
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by kyriakos876 »

I like how you were like:
"Okay, this doesn't work, but WHAT IF I added more quotes?"
*adds more quotes and it still doesn't work*
" Hm....Even more quotes?"
*adds more quotes and it works*
"Perfection"
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by SilverAzide »

LOL! :lol:
You discovered my secret... keep adding quotes and/or parentheses until it works!
Gadgets Wiki GitHub More Gadgets...
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by raiguard »

I am having a similar problem with the disk command for Disks Meter (I assume you came across this in yours as well). I put together my own sample skin to test it out:

Code: Select all

[Rainmeter]
AccurateText=1
MiddleMouseUpAction=[!Refresh]

[Variables]
command="C:\Windows\explorer.exe" /E,{drive}\

[MeasureCommand]
Measure=String
String=#command#
Substitute="{drive}":"C:"
IfCondition=1
IfTrueAction=[!SetOption MeterCommand LeftMouseUpAction "[MeasureCommand]"]

[MeterBackground]
Meter=Shape
Shape=Rectangle 1,1,155,30,1 | Fill Color 15,15,15 | StrokeWidth 0

[MeterCommand]
Meter=String
FontFace=Arial
FontSize=10
FontColor=240,240,240
X=5
Y=5
Text="Open explorer at 'C:\'"
MouseOverAction=[!SetOption MeterCommand FontColor "240,50,50"][!UpdateMeter MeterCommand][!Redraw]
MouseLeaveAction=[!SetOption MeterCommand FontColor "240,240,240"][!UpdateMeter MeterCommand][!Redraw]
Antialias=1
On Rainmeter 4.0, this works fine. But on the 4.1 betas, it doesn't appear to be parsing the quotes correctly. It keeps throwing a !SetOption: Skin "C:\WIndows\explorer.exe" not found error.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by Brian »

@SilverAzide and @raiguard: Thank you both for reporting this. The issue has been fixed for the next beta.

[Technical_Details]
This bug was introduced in the r2876 beta as a fix for when the new-style variable syntax was used as a complete bang sequence. You can read about the prior issue here, and my very lengthy and confusing explanation here.

This prior fix replaced any section variables in an action before the bang was parsed. However, in some cases where quotes were in the bang definition and also in the measures/variables referenced in the bang, the parsing of the bang saw empty quotes thinking it was a parameter, not an extra quote in the bang parameter.


The current fix for this issue also introduces a small backwards-compatibility issue going forward. If you are attempting to send a command to Windows AND that entire command (all the text between the brackets) is also the name of a measure, it will now replace the section variable with the measure's value, instead of executing the "raw" command.

For example:

Code: Select all

[cmd]
Measure=String
String=[notepad]

[Meter]
Meter=...
LeftMouseUpAction=[cmd]
In versions of Rainmeter prior to r2876, when clicking on the meter, the command window would pop up instead of notepad. Now it will open notepad.

The risk of having a measure name have the same name as a complete command sequence being sent to Windows is likely to not be an issue.
[/Technical_Details]

-Brian
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by eclectic-tech »

EDIT: Will try the new beta r2922 and check back...

Action bang is not resolving [measure] in 4.1 rbeta 2921 ... was working in 4.1 r2917 and prior.

4.1 r2922 corrected my issue... Thanks! :thumbup:
Last edited by eclectic-tech on October 4th, 2017, 3:42 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by jsmorley »

Please get the latest r2922 version just released. Hopefully that will sort it out.

Sorry for the hassle.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by jsmorley »

We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: [BUG] Quoting issue in 4.1 r2917 beta?

Post by raiguard »

jsmorley wrote:We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.
That made me laugh way harder than it probably should have. :rolmfao:

Anyway, I can confirm the issue is fixed now. Thanks!
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017