It is currently March 28th, 2024, 9:23 am

Tooltip question

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

Tooltip question

Post by xenium »

Hi,
I have the following example:

Code: Select all

[MeasureParent]
Measure=WebParser
Url=Url
RegExp=Exp

[MeasureChild1]
Measure=WebParser
Url=[MeasureParent]
StringIndex=1

[MeasureChild2]
Measure=WebParser
Url=[MeasureParent]
StringIndex=2

[MeasureChild3]
Measure=WebParser
Url=[MeasureParent]
StringIndex=3

[MeasureChild4]
Measure=WebParser
Url=[MeasureParent]
StringIndex=4

[MeasureChild5]
Measure=WebParser
Url=[MeasureParent]
StringIndex=5

[MeterTest]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
DynamicVariables=1
ToolTipText=[MeasureChild1]#CRLF#[MeasureChild2]#CRLF#[MeasureChild3]#CRLF#[MeasureChild4]#CRLF#[MeasureChild5]
If all measures return values, five values are displayed in the tooltip.
If not all measures return values, the number of values displayed in the tooltip may vary.
I would like to know if there is any solution so as to, ALWAYS, the last value is not displayed in the tooltip.
Ex:
If the measures return five values, only the first four values are displayed and the fifth value is not displayed.
If the measures return three values, only the first two values are displayed and the third value is not displayed.

Is that possible?

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

Re: Tooltip question

Post by balala »

xenium wrote: January 31st, 2019, 10:10 am If the measures return five values, only the first four values are displayed and the fifth value is not displayed.
If the measures return three values, only the first two values are displayed and the third value is not displayed.

Is that possible?
Not very clear what you mean by a measure doesn't return a value. It probably remains empty?
Not knowing the complete code, it's a bit harder to be sure, however I don't think this wouldn't be possible. Just add the following IfMatch options to the [MeasureChildX] measures:

Code: Select all

[MeasureChild1]
...
IfMatch=^$
IfMatchAction=[!SetVariable 1st "0"]
IfNotMatchAction=[!SetVariable 1st "1"]

[MeasureChild2]
...
IfMatch=^$
IfMatchAction=[!SetVariable 2nd "0"]
IfNotMatchAction=[!SetVariable 2nd "1"]

[MeasureChild3]
...
IfMatch=^$
IfMatchAction=[!SetVariable 3rd "0"]
IfNotMatchAction=[!SetVariable 3rd "1"]

[MeasureChild4]
...
IfMatch=^$
IfMatchAction=[!SetVariable 4th "0"]
IfNotMatchAction=[!SetVariable 4th "1"]

[MeasureChild5]
...
IfMatch=^$
IfMatchAction=[!SetVariable 5th "0"]
IfNotMatchAction=[!SetVariable 5th "1"]
The value of 1st, 2nd and so on variables are set either to 1 if the appropriate measure is returning something, or to 0 if it's not.
Based on the value of these variables you have to set the appropriate ToolTip:

Code: Select all

[MeasureNum]
Measure=Calc
Formula=( #1st# + #2nd# + #3rd# + #4th# + #5th# )
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterTest ToolTipHidden "1"]
IfCondition2=(#CURRENTSECTION#=2)
IfTrueAction2=[!SetOption MeterTest ToolTipHidden "0"][!SetOption MeterTest ToolTipText "[*MeasureChild1*]"][!UpdateMeter "MeterTest"]
IfCondition3=(#CURRENTSECTION#=3)
IfTrueAction3=[!SetOption MeterTest ToolTipHidden "0"][!SetOption MeterTest ToolTipText "[*MeasureChild1*]#CRLF#[*MeasureChild2*]"][!UpdateMeter "MeterTest"]
IfCondition4=(#CURRENTSECTION#=4)
IfTrueAction4=[!SetOption MeterTest ToolTipHidden "0"][!SetOption MeterTest ToolTipText "[*MeasureChild1*]#CRLF#[*MeasureChild2*]#CRLF#[*MeasureChild3*]"][!UpdateMeter "MeterTest"]
IfCondition5=(#CURRENTSECTION#=5)
IfTrueAction5=[!SetOption MeterTest ToolTipHidden "0"][!SetOption MeterTest ToolTipText "[*MeasureChild1*]#CRLF#[*MeasureChild2*]#CRLF#[*MeasureChild3*]#CRLF#[*MeasureChild4*]"][!UpdateMeter "MeterTest"]
DynamicVariables=1
Best would be to post the code of the parent WebParser measure ([MeasureParent]), with both options URL and RegExp, to can check. Anyway I suppose the above procedure would work.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Tooltip question

Post by xenium »

SkinTest.zip
(8.89 KiB) Downloaded 10 times
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tooltip question

Post by balala »

xenium wrote: February 1st, 2019, 1:00 pmSkinTest.zip
For example:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
UpdateRateSeconds=600
FontFace=century gothic
URL=https://weather.com/weather/today/l/USCA0638

[MeasureCity]
Measure=WebParser
Url=#URL#
RegExp=(?siU)(?(?=.*<h1 class="h4 today_nowcard-location").* className="h4 today_nowcard-location">(.*)<span class=".*" className=".*"></span></h1>)
UpdateRate=#UpdateRateSeconds#
LogSubstringErrors=0
StringIndex=1
Substitute="&#039;":"'"

[MeasureSevereAlert]
Measure=WebParser
Url=#URL#
RegExp=(?siU)(?(?=.*<a class="bg-alert-.*" href="/.*/.*/localalerts/l/.*").* .* className="bg-alert-.*">)
UpdateRate=#UpdateRateSeconds#
LogSubstringErrors=0
IfMatch=localalerts
IfMatchAction=[!EnableMeasure "MeasureALERT"][!UpdateMeasure "MeasureALERT"]

[MeasureALERT]
Measure=WebParser
Url=#URL#
RegExp=(?siU)(?(?=.*<a class="bg-alert-.*").* .* className="bg-alert-(.*)">.*<span class="warning-text" className="warning-text">(.*)</span><span class="timestamp" className="timestamp">(.*)</span>).*(?(?=.*<a class="bg-alert-.*").* .* className="bg-alert-(.*)">.*<span class="warning-text" className="warning-text">(.*)</span><span class="timestamp" className="timestamp">(.*)</span>).*(?(?=.*<a class="bg-alert-.*").* .* className="bg-alert-(.*)">.*<span class="warning-text" className="warning-text">(.*)</span><span class="timestamp" className="timestamp">(.*)</span>).*(?(?=.*<a class="bg-alert-.*").* .* className="bg-alert-(.*)">.*<span class="warning-text" className="warning-text">(.*)</span><span class="timestamp" className="timestamp">(.*)</span>).*(?(?=.*<a class="bg-alert-.*").* .* className="bg-alert-(.*)">.*<span class="warning-text" className="warning-text">(.*)</span><span class="timestamp" className="timestamp">(.*)</span>).*
UpdateRate=#UpdateRateSeconds#
LogSubstringErrors=0
IfMatch=priority bg-alert-1
IfMatchAction=[!ShowMeter "MeterAlertIcon1"]
IfNotMatchAction=[!HideMeter "MeterAlertIcon1"]                           
IfMatch2=priority bg-alert-2
IfMatchAction2=[!ShowMeter "MeterAlertIcon2"]
IfNotMatchAction2=[!HideMeter "MeterAlertIcon2"]
IfMatch3=priority bg-alert-3
IfMatchAction3=[!ShowMeter "MeterAlertIcon3"]
IfNotMatchAction3=[!HideMeter "MeterAlertIcon3"]
IfMatch4=priority bg-alert-4
IfMatchAction4=[!ShowMeter "MeterAlertIcon4"]
IfNotMatchAction4=[!HideMeter "MeterAlertIcon4"]
Disabled=1



[MeasureAlert1Level]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=1

[MeasureALERT1]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=2
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetVariable 1st "0"]
IfNotMatchAction=[!SetVariable 1st "1"]

[MeasureAlert1Time]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=3
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1

[MeasureAlert2Level]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=4

[MeasureALERT2]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=5
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetVariable 2nd "0"]
IfNotMatchAction=[!SetVariable 2nd "1"]

[MeasureAlert2Time]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=6
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1

[MeasureAlert3Level]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=7

[MeasureALERT3]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=8
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetVariable 3rd "0"]
IfNotMatchAction=[!SetVariable 3rd "1"]

[MeasureAlert3Time]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=9
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1

[MeasureAlert4Level]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=10

[MeasureALERT4]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=11
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetVariable 4th "0"]
IfNotMatchAction=[!SetVariable 4th "1"]

[MeasureAlert4Time]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=12
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1

[MeasureAlert5Level]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=13

[MeasureALERT5]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=14
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1
IfMatch=^$
IfMatchAction=[!SetVariable 5th "0"]
IfNotMatchAction=[!SetVariable 5th "1"]

[MeasureAlert5Time]
Measure=WebParser
Url=[MeasureALERT]
StringIndex=15
RegExpSubstitute=1
Substitute="^(?!\s*$)(.*)":"\1#CRLF#"
DynamicVariables=1

[MeasureNum]
Measure=Calc
Formula=( #1st# + #2nd# + #3rd# + #4th# + #5th# )
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOptionGroup Alerts ToolTipHidden "1"]
IfCondition2=(#CURRENTSECTION#=2)
IfTrueAction2=[!SetOptionGroup Alerts ToolTipHidden "0"][!SetOptionGroup Alerts ToolTipText "[*MeasureAlert1Level*]  [*MeasureALERT1*]    [*MeasureAlert1Time*]"][!UpdateMeterGroup "Alerts"]
IfCondition3=(#CURRENTSECTION#=3)
IfTrueAction3=[!SetOptionGroup Alerts ToolTipHidden "0"][!SetOptionGroup Alerts ToolTipText "[*MeasureAlert1Level*]  [*MeasureALERT1*]    [*MeasureAlert1Time*][*MeasureAlert2Level*]  [*MeasureALERT2*]    [*MeasureAlert2Time*]"][!UpdateMeterGroup "Alerts"]
IfCondition4=(#CURRENTSECTION#=4)
IfTrueAction4=[!SetOptionGroup Alerts ToolTipHidden "0"][!SetOptionGroup Alerts ToolTipText "[*MeasureAlert1Level*]  [*MeasureALERT1*]    [*MeasureAlert1Time*][*MeasureAlert2Level*]  [*MeasureALERT2*]    [*MeasureAlert2Time*][*MeasureAlert3Level*]  [*MeasureALERT3*]    [*MeasureAlert3Time*]"][!UpdateMeterGroup "Alerts"]
IfCondition5=(#CURRENTSECTION#=5)
IfTrueAction5=[!SetOptionGroup Alerts ToolTipHidden "0"][!SetOptionGroup Alerts ToolTipText "[*MeasureAlert1Level*]  [*MeasureALERT1*]    [*MeasureAlert1Time*][*MeasureAlert2Level*]  [*MeasureALERT2*]    [*MeasureAlert2Time*][*MeasureAlert3Level*]  [*MeasureALERT3*]    [*MeasureAlert3Time*][*MeasureAlert4Level*]  [*MeasureALERT4*]    [*MeasureAlert4Time*]"][!UpdateMeterGroup "Alerts"]
DynamicVariables=1

[MeterCity]
Meter=String
MeasureName=MeasureCity
X=0
Y=0
W=300
H=60
FontSize=12
FontColor=255,255,255,200
StringStyle=Bold
StringEffect=SHADOW
FontFace=#FontFace#
StringAlign=left
FontEffectColor=0,0,0,50
AntiAlias=1

[MeterAlertIcon1]
Meter=IMAGE
ImageName=#@#1.png
X=5
Y=25
W=30
H=30
Hidden=1
AntiAlias=1
ToolTipTitle=Severe Weather Alerts 
ToolTipType=1
ToolTipText=[MeasureAlert1Level]  [MeasureALERT1]    [MeasureAlert1Time][MeasureAlert2Level]  [MeasureALERT2]    [MeasureAlert2Time][MeasureAlert3Level]  [MeasureALERT3]    [MeasureAlert3Time][MeasureAlert4Level]  [MeasureALERT4]    [MeasureAlert4Time][MeasureAlert5Level]  [MeasureALERT5]    [MeasureAlert5Time]
DynamicVariables=1
Group=Alerts

[MeterAlertIcon2]
Meter=IMAGE
ImageName=#@#2.png
X=5
Y=25
W=30
H=30
Hidden=1
AntiAlias=1
ToolTipTitle=Severe Weather Alerts
ToolTipType=1
ToolTipText=[MeasureAlert1Level]  [MeasureALERT1]    [MeasureAlert1Time][MeasureAlert2Level]  [MeasureALERT2]    [MeasureAlert2Time][MeasureAlert3Level]  [MeasureALERT3]    [MeasureAlert3Time][MeasureAlert4Level]  [MeasureALERT4]    [MeasureAlert4Time][MeasureAlert5Level]  [MeasureALERT5]    [MeasureAlert5Time]
DynamicVariables=1
Group=Alerts

[MeterAlertIcon3]
Meter=IMAGE
ImageName=#@#3.png
X=5
Y=25
W=30
H=30
Hidden=1
AntiAlias=1
ToolTipTitle=Severe Weather Alerts
ToolTipType=1
ToolTipText=[MeasureAlert1Level]  [MeasureALERT1]    [MeasureAlert1Time][MeasureAlert2Level]  [MeasureALERT2]    [MeasureAlert2Time][MeasureAlert3Level]  [MeasureALERT3]    [MeasureAlert3Time][MeasureAlert4Level]  [MeasureALERT4]    [MeasureAlert4Time][MeasureAlert5Level]  [MeasureALERT5]    [MeasureAlert5Time]
DynamicVariables=1
Group=Alerts

[MeterAlertIcon4]
Meter=IMAGE
ImageName=#@#4.png
X=5
Y=25
W=30
H=30
Hidden=1
AntiAlias=1
ToolTipTitle=Severe Weather Alerts
ToolTipType=1
ToolTipText=[MeasureAlert1Level]  [MeasureALERT1]    [MeasureAlert1Time][MeasureAlert2Level]  [MeasureALERT2]    [MeasureAlert2Time][MeasureAlert3Level]  [MeasureALERT3]    [MeasureAlert3Time][MeasureAlert4Level]  [MeasureALERT4]    [MeasureAlert4Time][MeasureAlert5Level]  [MeasureALERT5]    [MeasureAlert5Time]
DynamicVariables=1
Group=Alerts
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Tooltip question

Post by xenium »

It works !
Thank you very much ! :bow:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tooltip question

Post by balala »

xenium wrote: February 1st, 2019, 6:03 pm It works !
Thank you very much ! :bow:
Glad to help.
Post Reply