It is currently March 29th, 2024, 1:29 pm

Value change icon

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

Re: Value change icon

Post by xenium »

FreeRaider wrote:New code (I hope this is what you would like to have)

Code: Select all

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

[Variables]
PrevValue=25
DirIcon=●

UpdateRateSeconds=600


URL=https://www.foreca.com/Canada/Quebec/Montreal

; =======================================================

[MeasureTemp]
Measure=Plugin
Plugin=WebParser
Url=#URL#
RegExp=(?siU)<span class=".* txt-xxlarge"><strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
RegExpSubstitute=1
Substitute="^\+(.*)":"\1","^\-(.*)":"-\1"
FinishAction=[!EnableMeasure MeasurePrev][!UpdateMeasure MeasurePrev]
DynamicVariables=1

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
Substitute="1":"+","-1":"-","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]

[MeterTemp]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Temperature:  [MeasurePrev][MeasureTemp] (#DirIcon#)
DynamicVariables=1
Works for positive temperatures but, now ,no longer works for negative temperatures
Example: -1 degree is displayed like this:
Capture.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Value change icon

Post by FreeRaider »

I am very sorry for that:
In [MeasurePrev], you change that posted with

Code: Select all

RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""

Code: Select all

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Value change icon

Post by balala »

I don't think you should have to include the name of the [MeasureTemp] measure to brackets into the IfCondition options. The following form of those options would be better:

Code: Select all

[MeasurePrev]
...
IfCondition=(#PrevValue#>MeasureTemp)
...
IfCondition2=(#PrevValue#<MeasureTemp)
...
IfCondition3=(#PrevValue#=MeasureTemp)
...
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Value change icon

Post by xenium »

FreeRaider wrote:I am very sorry for that:
In [MeasurePrev], you change that posted with

Code: Select all

RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""

Code: Select all

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
It works! :17good
Thank you very much :bow:
balala wrote:I don't think you should have to include the name of the [MeasureTemp] measure to brackets into the IfCondition options. The following form of those options would be better:

Code: Select all

[MeasurePrev]
...
IfCondition=(#PrevValue#>MeasureTemp)
...
IfCondition2=(#PrevValue#<MeasureTemp)
...
IfCondition3=(#PrevValue#=MeasureTemp)
...
I tried this form but the signs are no longer displayed correctly in relation to the values
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Value change icon

Post by xenium »

I would have a question

At this time, ▲ and ▼ signs remain displayed for only 10 minutes until a new skin update.
After that, because the value has not changed, they are no longer displayed (because the data on the website is updated at one hour).The ▬ sign will be displayed.
Is it possible for ▲ and ▼ signs to remain displayed until the website updates?
 
For example, to check if the update time has changed from the previous update time and if it has changed,then update the values and signs

I have posted the code that now includes MeasureUpdate and MeterUpdate
I hope I explained quite clearly what I would like

Code: Select all

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

[Variables]
PrevValue=31
DirIcon=●

UpdateRateSeconds=600


URL=https://www.foreca.com/Canada/Quebec/Montreal

; =======================================================

[MeasureUpdate]
Measure=WebParser
Url=#URL#
RegExp=(?siU)As of <strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1

[MeasureTemp]
Measure=Plugin
Plugin=WebParser
Url=#URL#
RegExp=(?siU)<span class=".* txt-xxlarge"><strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
RegExpSubstitute=1
Substitute="^\+(.*)":"\1","^\-(.*)":"-\1"
FinishAction=[!EnableMeasure MeasurePrev][!UpdateMeasure MeasurePrev]
DynamicVariables=1

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]

[MeterTemp]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Temperature: [MeasurePrev][MeasureTemp] (#DirIcon#)
DynamicVariables=1

[MeterUpdate]
Meter=String
MeasureName=MeasureUpdate
X=6 
Y=35
W=120
H=60
FontSize=8
FontColor=255,255,255,255
StringStyle=Normal
StringEffect=SHADOW
StringAlign=Left
FontEffectColor=0,0,0,50
AntiAlias=1
Prefix="Update: "
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Value change icon

Post by balala »

xenium wrote:I would have a question

At this time, ▲ and ▼ signs remain displayed for only 10 minutes until a new skin update.
After that, because the value has not changed, they are no longer displayed (because the data on the website is updated at one hour).The ▬ sign will be displayed.
Is it possible for ▲ and ▼ signs to remain displayed until the website updates?
 
For example, to check if the update time has changed from the previous update time and if it has changed,then update the values and signs

I have posted the code that now includes MeasureUpdate and MeterUpdate
I hope I explained quite clearly what I would like
Yep, you did.
Although I never tried this before, I think the following approach should have to work.
First you have to modify the [MeasureTemp] measure, in a way to not being updated automatically. for this add an UpdateDivider=-1 option to it OR modify its UpdateRate option to -1 (UpdateRate=-1).
Then you have to update this measure every time the value returned by the [MeasureUpdate] measure changes. This can be easily done adding an (OnChange[color=#FF0000]Value[/color]=[!CommandMeasure "MeasureTemp" "Update"]) OnChangeAction=[!CommandMeasure "MeasureTemp" "Update"] option to the [MeasureUpdate] measure.
Last edited by balala on July 2nd, 2018, 7:09 pm, edited 1 time in total.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Value change icon

Post by xenium »

balala wrote:Yep, you did.
Although I never tried this before, I think the following approach should have to work.
First you have to modify the [MeasureTemp] measure, in a way to not being updated automatically. for this add an UpdateDivider=-1 option to it OR modify its UpdateRate option to -1 (UpdateRate=-1).
Then you have to update this measure every time the value returned by the [MeasureUpdate] measure changes. This can be easily done adding an OnChangeValue=[!CommandMeasure "MeasureTemp" "Update"] option to the [MeasureUpdate] measure.
Not working !
[MeasureTemp] does not update when the [ Measurepdate] value changes
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Value change icon

Post by balala »

xenium wrote:Not working !
[MeasureTemp] does not update when the [ Measurepdate] value changes
Post please your modified code, once again.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Value change icon

Post by xenium »

balala wrote:Post please your modified code, once again.

Code: Select all

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

[Variables]
PrevValue=33
DirIcon=●

UpdateRateSeconds=600


URL=https://www.foreca.com/Canada/Quebec/Montreal

; =======================================================

[MeasureUpdate]
Measure=WebParser
Url=#URL#
RegExp=(?siU)As of <strong>.* (.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
OnChangeValue=[!CommandMeasure "MeasureTemp" "Update"]

[MeasureTemp]
Measure=Plugin
Plugin=WebParser
Url=#URL#
RegExp=(?siU)<span class=".* txt-xxlarge"><strong>(.*)</strong>
UpdateDivider=-1
StringIndex=1
RegExpSubstitute=1
Substitute="^\+(.*)":"\1","^\-(.*)":"-\1"
FinishAction=[!EnableMeasure MeasurePrev][!UpdateMeasure MeasurePrev]
DynamicVariables=1

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]"][!UpdateMeter *][!Redraw]

[MeterTemp]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Temperature: [MeasurePrev][MeasureTemp] (#DirIcon#)
DynamicVariables=1

[MeterUpdate]
Meter=String
MeasureName=MeasureUpdate
X=6 
Y=35
W=120
H=60
FontSize=8
FontColor=255,255,255,255
StringStyle=Normal
StringEffect=SHADOW
StringAlign=Left
FontEffectColor=0,0,0,50
AntiAlias=1
Prefix="Update: "
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Value change icon

Post by PtitChat107 »

I allow myself to intervene, but in the case of the repeated use of this function; would it be possible to gather all the "ValuePrev" in one file instead of finding it in the Variables ?