It is currently April 27th, 2024, 2:40 pm

Using IfMatch on Skin Paths

Get help with creating, editing & fixing problems with skins
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Using IfMatch on Skin Paths

Post by RicardoTM »

Hey, looking for an alternative here.

I need a measure that enables or disables another measure based on the value of a variable. That variable must be the current skin path, if that variable isn't exactly the current skin path, then the other measure enables and writes the correct path to the variable. So, if [#VARIABLEPATH] = [#CURRENTPATH] then the other measure stays disabled. If that's not true, then the other measure is enabled and writes the [#CURRENTPATH] to the [#VARIABLEPATH] which makes the measure be true and disables the other measure.

My problem is that, when I try this

Code: Select all

[mPath]
;This measure compares the current VariablePath against CurrentPath and determines if it's necessary to write it or not.
Measure=String
String=[#VariablePath]
Substitute="":"N/A"
RegExpSubstitute=1
IfMatch=[#CURRENTPATH]
IfMatchAction=[!DisableMeasure wPath]
IfNotMatchAction=[!EnableMeasure wPath][!UpdateMeasure wPath]
DynamicVariables=1

[wPath]
;This measure writes the correct path to the variable.
Disabled=1
Measure=Calc
OnUpdateAction=[!SetVariable VariablePath [#CURRENTPATH]] [!Writekeyvalue Variables VariablePath [#CURRENTPATH] "#@#Settings.inc"][!UpdateMeasure mPath]
UpdateDivider=-1
I get this error:Error: "PCRE does not support \L, \l, \N{name}, \U, or \u" in IfMatch=C:\Users\User\[...]
Because paths have all that not supported stuff.

The reason why I need this is kinna hard to explain, but long story short, I need the current path of this skin on another skin. I just need a measure that correctly tells if the path on the variable is exactly the same as the currentpath or not. I tried using IfConditions but it wouldn't do the job either.

like:

Code: Select all

[mPath]
;This measure compares the current VariablePath against CurrentPath and determines if it's necessary to write it or not.
Measure=String
String=[#VariablePath]
Substitute="":"N/A"
RegExpSubstitute=1
IfCondition=[[#CURRENTSECTION]] = [#CURRENTPATH]
IfTrueAction= [!DisableMeasure wPath]
IfFalseAction=[!EnableMeasure wPath][!UpdateMeasure wPath]
DynamicVariables=1

[wPath]
;This measure writes the correct path to the variable.
Disabled=1
Measure=Calc
OnUpdateAction=[!SetVariable VariablePath [#CURRENTPATH]] [!Writekeyvalue Variables VariablePath [#CURRENTPATH] "#@#Settings.inc"][!UpdateMeasure mPath]
UpdateDivider=-1
This gets the error "N" is unknown: IfCondition=N/A = C:\Users\User\[...]
Because I guess that's supposed to only be used with numeric values and not strings.

Thanks in advance.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2611
Joined: March 23rd, 2015, 5:26 pm

Re: Using IfMatch on Skin Paths

Post by SilverAzide »

RicardoTM wrote: January 6th, 2024, 10:31 pm
The easiest fix is to change all backslashes to either forward slashes or double backslashes; i.e., "C:/Users/..." or "C:\\Users\\..." You'll need to do that for the both the current path and the "variable path".

Code: Select all

[currPath]
Measure=String
String=#CURRENTPATH#
Substitute="\":"/"

[mPath]
;This measure compares the current VariablePath against CurrentPath and determines if it's necessary to write it or not.
Measure=String
String=#VariablePath#
Substitute="":"N/A","\":"/"
IfMatch=[currPath]
IfMatchAction=[!DisableMeasure wPath]
IfNotMatchAction=[!EnableMeasure wPath][!UpdateMeasure wPath]
DynamicVariables=1
P.S.: Get rid of the RegExpSubstitute=1 line. For what you are doing, you don't need it.
Gadgets Wiki GitHub More Gadgets...
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Using IfMatch on Skin Paths

Post by RicardoTM »

SilverAzide wrote: January 7th, 2024, 1:30 am
Interesting, I thought of that but didn't try it since I thought it wouldn't work, surprisingly it doesn't matter if a path uses \,/ or \\.

Thanks Silver, this solves it perfectly.