It is currently April 23rd, 2024, 3:42 pm

"#@#" Shown as full path when read as nested variable.

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7149
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: "#@#" Shown as full path when read as nested variable.

Post by Yincognito »

_3D_ wrote: August 21st, 2020, 1:41 amI'm not sure I fully understood you since the change hasn't made any effect. I do understand the magic quotes though since I've used them elsewhere, I'm just not sure on how they apply here, so i would be grateful for a bit more context.
I would check your skin only if it was really needed in order to make things work, as generally it's easier and more effective to explain or do things in simple bits of code that can be both written and understood without much effort. So with this in mind, the following code works for me, even without magic quotes (create an empty Variables.inc file in your @Resources folder to see what's written in it by this code):

Code: Select all

[Variables]
ButtonN=8
MouseButton=LMD
B8_4_LMD=#@#Scripts\FF_Left_Window.exe

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureVAR_4]
Measure=String
String=[#B[#ButtonN]_4_[#MouseButton]]
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^.*@Resources\\":"#*@*#"

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Segoe UI
StringStyle=Italic
FontSize=14
X=5
Y=5
H=25
W=400
DefaultValue=[MeasureVAR_4]
Command1=[!WriteKeyValue Variables "B#ButtonN#_4_#MouseButton#" "$UserInput$" "#@#Variables.inc"]

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=410
H=35

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=Press to write the key to #*@*#Variables.inc ...
LeftMouseUpAction=[!CommandMeasure "MeasureInput" "ExecuteBatch 1"]
Isn't this what you wanted?

P.S. Using !Refresh and @Including the Variables.inc file in your skin doesn't change things. Of course, in the About/Skins the variable will be the actual path, as #@# is resolved and all that.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
_3D_
Posts: 16
Joined: July 25th, 2020, 12:46 pm
Location: London, UK.

Re: "#@#" Shown as full path when read as nested variable.

Post by _3D_ »

Apologies, I wasn't clear in the wording of the new problem so let me try again, the skin you have now provided is doing exactly the same thing as mine, while working fine, the text that's actually written to the .inc is literal.

While totally unnecessary, i was wondering if we could parse the $UserInput$ to correct the path before writing it to the Variables.inc file.

E.g. I paste: "C:\`Custom\Apps\Rainmeter\Skins\RainTask\@Resources\Scripts\PrintScreenByArea.exe" and press enter.

Then have the skin write that line as "#@#Scripts\PrintScreenByArea.exe" in the Variables.inc.

My guess is it would go something like this:

Code: Select all

[Variables]
ButtonN=8
MouseButton=LMD
B8_4_LMD=#@#Scripts\FF_Left_Window.exe

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
;C:\`Custom\Apps\Rainmeter\Skins\RainTask\@Resources\Apps\RainFocus.exe

[MeasureVAR_4]
Measure=String
String=[#B[#ButtonN]_4_[#MouseButton]]
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^.*@Resources\\":"#*@*#"

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Segoe UI
StringStyle=Italic
FontSize=14
X=5
Y=5
H=25
W=400
DefaultValue=[MeasureVAR_4]
Command1=[!SetVariable "[#B[#ButtonN]_4_[#MouseButton]]" "$UserInput$"]
Command2=[!UpdateMeasure MeasureVAR_4][!Redraw]
Command3=[!WriteKeyValue Variables "B#ButtonN#_4_#MouseButton#" "[MeasureVAR_4]" "#@#Variables.inc"]

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=410
H=35

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=Press to write the key to #*@*#Variables.inc ...
LeftMouseUpAction=[!CommandMeasure "MeasureInput" "ExecuteBatch All"]
My problem is with the syntax in Command3 of [MeasureInput]:
Command3=[!WriteKeyValue Variables "B#ButtonN#_4_#MouseButton#" "[MeasureVAR_4]" "#@#Variables.inc"]
I'm obviously not allowed to use "[MeasureVAR_4]" here, and i was unsure on how to resolve that part.
Yellow on white is seldom a good idea.
My DeviantArt Page
User avatar
Yincognito
Rainmeter Sage
Posts: 7149
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: "#@#" Shown as full path when read as nested variable.

Post by Yincognito »

_3D_ wrote: August 21st, 2020, 10:23 am Apologies, I wasn't clear in the wording of the new problem so let me try again, the skin you have now provided is doing exactly the same thing as mine, while working fine, the text that's actually written to the .inc is literal.

While totally unnecessary, i was wondering if we could parse the $UserInput$ to correct the path before writing it to the Variables.inc file.

E.g. I paste: "C:\`Custom\Apps\Rainmeter\Skins\RainTask\@Resources\Scripts\PrintScreenByArea.exe" and press enter.

Then have the skin write that line as "#@#Scripts\PrintScreenByArea.exe" in the Variables.inc.

My problem is with the syntax in Command3 of [MeasureInput]:
Command3=[!WriteKeyValue Variables "B#ButtonN#_4_#MouseButton#" "[MeasureVAR_4]" "#@#Variables.inc"]
I'm obviously not allowed to use "[MeasureVAR_4]" here, and i was unsure on how to resolve that part.
Ah, now I see. The following code will do the job:

Code: Select all

[Variables]
ButtonN=8
MouseButton=LMD
B8_4_LMD=#@#Scripts\FF_Left_Window.exe

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
;C:\`Custom\Apps\Rainmeter\Skins\RainTask\@Resources\Apps\RainFocus.exe

[MeasureVAR_4]
Measure=String
String=[#B[#ButtonN]_4_[#MouseButton]]
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^.*@Resources\\":"#*@*#"
DynamicVariables=1

[MeasureInput]
Measure=Plugin
Plugin=InputText
SolidColor=76A0E8FF
FontColor=255,255,255,255
FontFace=Segoe UI
StringStyle=Italic
FontSize=14
X=5
Y=5
H=25
W=400
DefaultValue=[MeasureVAR_4]
Command1=[!SetVariable "B#ButtonN#_4_#MouseButton#" "$UserInput$"]
Command2=[!UpdateMeasure MeasureVAR_4]
Command3=[!WriteKeyValue Variables "B#ButtonN#_4_#MouseButton#" "[MeasureVAR_4]" "#@#Variables.inc"]

[MeterBackground]
Meter=Image
SolidColor=1E3A69FF
W=410
H=35

[MeterWriteKeyValue]
Meter=String
X=5
Y=5
FontSize=15
FontColor=255,255,255,255
AntiAlias=1
Text=Press to write the key to #*@*#Variables.inc ...
LeftMouseUpAction=[!CommandMeasure "MeasureInput" "ExecuteBatch All"]
The problem wasn't your Command3, but Command1, which esentially does pretty much the same as Command3 in setting the variable, the only differences being that it does it in memory instead of on the disk and a different value is assigned to it - so the syntax must be similar to Command3 as well. Also, dynamic variables are needed in the first measure as the variable passed to the String option is changing while the skin is active. One other thing, the !Redraw wasn't necessary as you don't change the visuals anywhere - a simple update of the first measure was enough.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
_3D_
Posts: 16
Joined: July 25th, 2020, 12:46 pm
Location: London, UK.

Re: "#@#" Shown as full path when read as nested variable.

Post by _3D_ »

Brilliant, that works perfectly now, thanks so much! :thumbup:
Yellow on white is seldom a good idea.
My DeviantArt Page
User avatar
Yincognito
Rainmeter Sage
Posts: 7149
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: "#@#" Shown as full path when read as nested variable.

Post by Yincognito »

_3D_ wrote: August 21st, 2020, 11:59 am Brilliant, that works perfectly now, thanks so much! :thumbup:
No problem - you've done 90% of the job, to be fair. I only corrected here and there, that's all. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth