It is currently May 2nd, 2024, 4:09 pm

IfMatch Question

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 868
Joined: January 4th, 2018, 9:52 pm

IfMatch Question

Post by xenium »

Hi,
I would like to use something similar, but for measures when displayed in the tooltip, to narrow the size of the tooltip only to the measures that are displayed:

Code: Select all

IfMatch=^$
IfMatchAction=[!HideMeter "MeterA"]
IfNotMatchAction=[!ShowMeter "MeterA"]
Is that possible?

Thank you
User avatar
balala
Rainmeter Sage
Posts: 16194
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfMatch Question

Post by balala »

Since after more then 24 hours you still didn't get nor a reply, I think people are agree me, that we didn't understand what would you like. Me at least, definitely didn't. A few details would be great. You would like to set the width of the tooltip? Possible. But the ToolTips are related to meters, not to measures. So what would be with the "measures that are displayed"?
User avatar
xenium
Posts: 868
Joined: January 4th, 2018, 9:52 pm

Re: IfMatch Question

Post by xenium »

balala wrote: December 2nd, 2018, 3:58 pm Since after more then 24 hours you still didn't get nor a reply, I think people are agree me, that we didn't understand what would you like. Me at least, definitely didn't. A few details would be great. You would like to set the width of the tooltip? Possible. But the ToolTips are related to meters, not to measures. So what would be with the "measures that are displayed"?
In the tooltip below, there must still be 5 parameters, but there is no data about them at this time.
I would like that when there is no data about certain parameters, the height of the tooltip should be adjusted only to the displayed parameters
(without that empty space)
Capture5.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch Question

Post by jsmorley »

xenium wrote: December 2nd, 2018, 4:32 pm In the tooltip below, there must still be 5 parameters, but there is no data about them at this time.
I would like that when there is no data about certain parameters, the height of the tooltip should be adjusted only to the displayed parameters
(without that empty space)
Capture5.PNG
This will be difficult. While in theory you could have IfMatch actions on all the measures returning values, testing for an empty string, and defining the entire ToolTipText for the meter in question appropriately, the trouble is that this isn't a pure cascading result set. So for instance, if you have 5 measures returning values, you might be missing 3 and 5, or 2 and 4 or whatever, and that will make IfMatch difficult to use really, there is no way to say "if this matches and that doesn't OR if this doesn't match but this does", if you see what I mean.

The trouble you are having now is that you are defining the ToolTipText as something like ToolTipText=[MeasureOne]#CRLF#[MeasureTwo]#CRLF#. So if a measure value is an empty string, that's fine, but the #CRLF# is still displayed.

While it is tempting to use Substitute to add the #CRLF# to the string value of the measure(s), but ONLY if they are not an empty string, that would take some thought. Edit: See next reply...
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch Question

Post by jsmorley »

Ok, I think I found a way using RegExpSubtitute:

Code: Select all

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

[Variables]

[MeasureString1]
Measure=String
String=String One
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString2]
Measure=String
String=""
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString3]
Measure=String
String=String Three
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString4]
Measure=String
String=""
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=Hover me!
ToolTipText=[MeasureString1][MeasureString2][MeasureString3][MeasureString4]
1.png

So as noted in my earlier post, we are adding the #CRLF# to the string values when they are "used" in the meter, but only if they have at least one character in them that isn't just white space. Note that this does not in any way change the actual string value of the measure(s).

https://stackoverflow.com/questions/3085539/regular-expression-for-anything-but-an-empty-string

This is a moderately geeky regular expression. What it is saying is:

^(?!\s*$)(.*)

Start at the beginning of the string ^
Begin a look ahead directive (?
if NOT !
white space \s
in any number of characters *
till the end of the string $
end directive )
Capture all characters (.*)

If there isn't at least one character that isn't white space, the match fails and the substitution is not done, so you don't get the #CRLF#.
You do not have the required permissions to view the files attached to this post.
User avatar
xenium
Posts: 868
Joined: January 4th, 2018, 9:52 pm

Re: IfMatch Question

Post by xenium »

jsmorley wrote: December 2nd, 2018, 5:07 pm Ok, I think I found a way using RegExpSubtitute:

Code: Select all

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

[Variables]

[MeasureString1]
Measure=String
String=String One
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString2]
Measure=String
String=""
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString3]
Measure=String
String=String Three
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeasureString4]
Measure=String
String=""
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"

[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=Hover me!
ToolTipText=[MeasureString1][MeasureString2][MeasureString3][MeasureString4]

1.png


So as noted in my earlier post, we are adding the #CRLF# to the string values when they are "used" in the meter, but only if they have at least one character in them that isn't just white space. Note that this does not in any way change the actual string value of the measure(s).

https://stackoverflow.com/questions/3085539/regular-expression-for-anything-but-an-empty-string

This is a moderately geeky regular expression. What it is saying is:

^(?!\s*$)(.*)

Start at the beginning of the string ^
Begin a directive (?
if NOT !
white space \s
in any number of characters *
till the end of the string $
end directive )
Capture all characters (.*)

If there isn't at least one character that isn't white space, the match fails and the substitution is not done, so you don't get the #CRLF#.
Amazing, it works !!!! :17drums

You are great !!
:Medal :Trophy

Thank you very ,very much !! :bow:
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch Question

Post by jsmorley »

Glad to help. That is about as geeky with regular expression that I ever want to get... ;-)
User avatar
xenium
Posts: 868
Joined: January 4th, 2018, 9:52 pm

Re: IfMatch Question

Post by xenium »

Hi,
I have the following example:

Code: Select all

[MeasureA]
Measure=WebParser
Url=#URL#
RegExp=(?siU)(?(?=.*<Item>).*<Name1>(.*)</Name2>)
IfMatch=  |Name1.*Name2
IfMatchAction=[!DisableMeasure "MeasureB"]
I want that when in RegExp is the name1 together with the name2, or the entire RegExp is missing, be disabled MeasureB.
I do not know what to use when the entire RegExp is missing

Thank you
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IfMatch Question

Post by jsmorley »

xenium wrote: December 10th, 2018, 12:54 pm Hi,
I have the following example:

Code: Select all

[MeasureA]
Measure=WebParser
Url=#URL#
RegExp=(?siU)(?(?=.*<Item>).*<Name1>(.*)</Name2>)
IfMatch=  |Name1.*Name2
IfMatchAction=[!DisableMeasure "MeasureB"]
I want that when in RegExp is the name1 together with the name2, or the entire RegExp is missing, be disabled MeasureB.
I do not know what to use when the entire RegExp is missing

Thank you
I don't follow what you want...
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: IfMatch Question

Post by kyriakos876 »

jsmorley wrote: December 10th, 2018, 12:57 pm I don't follow what you want...
I think he wants an IfMatch that works with 2 conditions.
1) If the RegExp returns nothing, disable MeasureB.
2) If the RegExp return Name1 AND Name2, disable MeasureB.

(don't know the syntax tho so I hope you can fill it from here if that's what he wants.)