It is currently March 29th, 2024, 2:21 pm

#CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Report bugs with the Rainmeter application and suggest features.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

#CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by death.crafter »

When I try to send a !SetVariable bang with #CRLF# to Rainmeter.exe, it isn't resolved to a new line character, or it's not resolved at all.

For example:

Code: Select all

"path\to\Rainmeter.exe" "[!SetVariable SomeVariable \"String#CRLF#String\" \"MyConfig\"]"
the variable shows up as String#CRLF#String.

P.S.: Using \n instead of #CRLF# does the job but since #CRLF# is resolved in !SetOption bang when used from outside, I thought it might be a bug.
from the Realm of Death
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: #CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by nek »

I'm not sure what you are trying to do, but this will work with #CRLF#.
send-crlf02.png

Code: Select all

[Rainmeter]
Update=-1
AccurateText=1

[Variables]


[msRunCommand]
Measure=Plugin
Plugin=RunCommand
Program=""#PROGRAMPATH#Rainmeter.exe""
Parameter=[!SetVariable VAR "1#CRLF#2" "#CURRENTCONFIG#"]

[mtString1]
Meter=String
Text=Onett
Antialias=1
SolidColor=333333FF
FontColor=FFFFFFFF
FontSize=16
Padding=4,0,4,0
LeftMouseUpAction=[!CommandMeasure msRunCommand "Run"]

;; This will create a new process (with wrong parameters?), so I don't use.
;LeftMouseUpAction=["#PROGRAMPATH#Rainmeter.exe" "SomeParameters"]
send-crlf06.png


You might use Process Monitor - Microsoft(Sysinternals) for debugging.
send-crlf04.png
Usage of Process Monitor:
1. Load a Rainmeter skin.
send-crlf02.png
2. Install and Run a Process Monitor.
3. Filter settings: Process Name is Rainmeter.exe then Include, click on the Add button. Click on the OK.
send-crlf01.png
4. Stop capture. Make sure that only process button is ON, others are OFF.
send-crlf07.png
5. Clear log and start capture.
6. Click on the skin.
send-crlf02.png
7. Stop capture, right-click the row Rainmeter.exe where Operation is Process Start, select Properties...
send-crlf03.png
8. You will see the Command line.
send-crlf04.png
9. About Rainmeter window > Skins tab, right-click on the VAR and select Copy to clipboard.
If you can't see the VAR, close the About Rainmeter window then open it again.
send-crlf05.png
10. Paste to a text editor, you will see the actual value.
send-crlf06.png
You do not have the required permissions to view the files attached to this post.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: #CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by death.crafter »

nek wrote: October 3rd, 2021, 12:05 pm I'm not sure what you are trying to do, but this will work with #CRLF#.
send-crlf02.png

Code: Select all

[Rainmeter]
Update=-1
AccurateText=1

[Variables]


[msRunCommand]
Measure=Plugin
Plugin=RunCommand
Program=""#PROGRAMPATH#Rainmeter.exe""
Parameter=[!SetVariable VAR "1#CRLF#2" "#CURRENTCONFIG#"]

[mtString1]
Meter=String
Text=Onett
Antialias=1
SolidColor=333333FF
FontColor=FFFFFFFF
FontSize=16
Padding=4,0,4,0
LeftMouseUpAction=[!CommandMeasure msRunCommand "Run"]

;; This will create a new process (with wrong parameters?), so I don't use.
;LeftMouseUpAction=["#PROGRAMPATH#Rainmeter.exe" "SomeParameters"]
This is because the Parameter option is read by Rainmeter and already resolved before being sent as a parameter.

I am talking about bangs sent from outer sources.
from the Realm of Death
User avatar
nek
Posts: 105
Joined: November 3rd, 2019, 12:00 am

Re: #CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by nek »

I totally misunderstood. Sorry to bother you.

> Skin.cpp - void Skin::SetVariable
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: #CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by Brian »

This isn't a bug since #variables# have no context outside of a skin.

Inside Rainmeter, regular #variables# are parsed and replaced when an option is read. Since you are sending in a variable outside of Rainmeter, there is no parsing.

However....there is a work-around.

https://docs.rainmeter.net/manual/variables/nesting-variables/#Notes

Nested variables are parsed when a bang is executed. So, you could use nested syntax to accomplish this.

"path\to\Rainmeter.exe" "[!SetVariable SomeVariable \"String[#CRLF]String\" \"MyConfig\"]"

-Brian
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: #CRLF# is not resolved with !SetVariable bang when used with Rainmeter.exe

Post by death.crafter »

Brian wrote: October 3rd, 2021, 7:58 pm This isn't a bug since #variables# have no context outside of a skin.

Inside Rainmeter, regular #variables# are parsed and replaced when an option is read. Since you are sending in a variable outside of Rainmeter, there is no parsing.

However....there is a work-around.

https://docs.rainmeter.net/manual/variables/nesting-variables/#Notes

Nested variables are parsed when a bang is executed. So, you could use nested syntax to accomplish this.

"path\to\Rainmeter.exe" "[!SetVariable SomeVariable \"String[#CRLF]String\" \"MyConfig\"]"

-Brian
Oh my god... How could I not think of that. Now I don't have to setup work arounds.

Thanks, Brian.
from the Realm of Death