It is currently April 20th, 2024, 1:42 pm

Color & data recovery

Get help with creating, editing & fixing problems with skins
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Color & data recovery

Post by PtitChat107 »

Hello everyone,
You will see it in the name of the attached file, although a bit macabre, I put in place a small skin concerning the epidemic which is currently spreading in the world (as well as in a country in particular).
Only here, I note two major problems for which I have not yet managed to find a solution:
1. The colors should not be found on the whole of the text, but only on the icons dealing with signaling an increase; decreased or stagnant state the number of people in each category (in the world and in the country concerned).
2. One of the sources does not seem to work when it works perfectly on "RainRegExp"; there either impossible to understand the problem.

If anyone could help me, I would greatly appreciate it and thank you in advance. :)
Last edited by PtitChat107 on April 12th, 2020, 8:14 am, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7130
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Color & data recovery

Post by Yincognito »

PtitChat107 wrote: March 9th, 2020, 9:29 am Hello everyone,
You will see it in the name of the attached file, although a bit macabre, I put in place a small skin concerning the epidemic which is currently spreading in the world (as well as in a country in particular).
Only here, I note two major problems for which I have not yet managed to find a solution:
1. The colors should not be found on the whole of the text, but only on the icons dealing with signaling an increase; decreased or stagnant state the number of people in each category (in the world and in the country concerned).
2. One of the sources does not seem to work when it works perfectly on "RainRegExp"; there either impossible to understand the problem.

If anyone could help me, I would greatly appreciate it and thank you in advance. :)
I will help you, but first I have to correct some things in your skin. I don't know why you folks seem to think that a WebParser parent is its capture, LOL. It's the second time I see this type of code...

That being said, you want only the unicode characters colored, and not the text itself, right? Obviously, red if increasing, green if decreasing, blue if stationary. Also, which one of the "sources" don't seem to work? Cause, you know, it's just one source (only the php query is different), and the only thing I noticed it didn't work was one or two variables (and not "sources").
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Color & data recovery

Post by PtitChat107 »

Yincognito wrote:Also, which one of the "sources" don't seem to work? Cause, you know, it's just one source (only the php query is different), and the only thing I noticed it didn't work was one or two variables (and not "sources").
Indeed, I should have been more precise in my words and I apologize, it is the request with the name "measureRecovered" which have a problem. Then concerning the colors, and it is only necessary that the Unicode codes can change color and not the text; that should make the table much more understandable.
dvo wrote:in holland we have it allready made on the site [link removed]
Regarding my main source, it is here ! :)
User avatar
Yincognito
Rainmeter Sage
Posts: 7130
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Color & data recovery

Post by Yincognito »

PtitChat107 wrote: March 9th, 2020, 12:49 pm Indeed, I should have been more precise in my words and I apologize, it is the request with the name "measureRecovered" which have a problem. Then concerning the colors, and it is only necessary that the Unicode codes can change color and not the text; that should make the table much more understandable.

Regarding my main source, it is here ! :)
Ok, so I rewrote the skin to take a different approach ... but experienced significant delays in getting data after a while. I'm not exactly banned, but it takes a while to get the info about the overall sums of Confirmed / Deaths / Recovered, and I also get null values. Anyway, the skin should work for those who don't (or didn't) poll the site often. In any case, you should investigate if you can parse the site in a single API query (using WHERE field = value, for example), instead of 4 queries, like it is now. The code:

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=
Author=
Information=
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
@include1=UserVariables.inc
Country=France

;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Confirmed%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&outSR=102100&cacheHint=true
;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Deaths%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true
;Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=[{%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Recovered%22%2C%22outStatisticFieldName%22%3A%22value%22}]&outSR=102100&cacheHint=true


; ----------------------------------
; MEASURES
; ----------------------------------

[measureDirIconInc]
Measure=String
String=▲
UpdateDivider=-1

[measureDirIconDec]
Measure=String
String=▼
UpdateDivider=-1

[measureDirIconEqu]
Measure=String
String=▬
UpdateDivider=-1

[measurePreviousValues]
Measure=WebParser
URL="file://#CURRENTPATH#PrevVariables.inc"
RegExp=(?siU).*PrevValueConfirmed=(\d+)\r?\nPrevValueDeceased=(\d+)\r?\nPrevValueRecovered=(\d+)\r?\nPrevValueConfirmedCountry=(\d+)\r?\nPrevValueDeceasedCountry=(\d+)\r?\nPrevValueRecoveredCountry=(\d+)\r?\n.*
CodePage=1200
FinishAction=[!UpdateMeasureGroup PreviousValuesGroup][!CommandMeasure measureCountry "Update"]
OnConnectErrorAction=[!UpdateMeasureGroup PreviousValuesGroup][!CommandMeasure measureCountry "Update"]
OnRegExpErrorAction=[!UpdateMeasureGroup PreviousValuesGroup][!CommandMeasure measureCountry "Update"]
UpdateRate=600
DynamicVariables=1

[measurePrevValueConfirmed]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=1
UpdateDivider=-1

[measurePrevValueDeceased]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=2
UpdateDivider=-1

[measurePrevValueRecovered]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=3
UpdateDivider=-1

[measurePrevValueConfirmedCountry]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=4
UpdateDivider=-1

[measurePrevValueDeceasedCountry]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=5
UpdateDivider=-1

[measurePrevValueRecoveredCountry]
Group=PreviousValuesGroup
Measure=WebParser
URL=[measurePreviousValues]
StringIndex=6
UpdateDivider=-1

[measureCountry]
Measure=WebParser
URL=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
RegExp=(?siU)\{.*,"Country_Region":"(#Country#)","Last_Update":(.*)...,"Lat":(.*),"Long_":(.*),"Confirmed":(.*),"Deaths":(.*),"Recovered":(.*)\}
FinishAction=[!UpdateMeasureGroup CountryGroup][!CommandMeasure measureConfirmedSource "Update"]
OnConnectErrorAction=[!UpdateMeasureGroup CountryGroup][!CommandMeasure measureConfirmedSource "Update"]
OnRegExpErrorAction=[!UpdateMeasureGroup CountryGroup][!CommandMeasure measureConfirmedSource "Update"]
UpdateRate=-1
DynamicVariables=1

[measureConfirmedCountry]
Group=CountryGroup
Measure=WebParser
URL=[measureCountry]
StringIndex=5
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureConfirmedCountry > measurePrevValueConfirmedCountry)
IfTrueAction=[!SetOption MeterValueConfirmed MeasureName2 "measureDirIconInc"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
IfCondition2=(measureConfirmedCountry < measurePrevValueConfirmedCountry)
IfTrueAction2=[!SetOption MeterValueConfirmed MeasureName2 "measureDirIconDec"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
IfCondition3=(measureConfirmedCountry = measurePrevValueConfirmedCountry)
IfTrueAction3=[!SetOption MeterValueConfirmed MeasureName2 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
DynamicVariables=1

[measureDeceasedCountry]
Group=CountryGroup
Measure=WebParser
URL=[measureCountry]
StringIndex=6
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureDeceasedCountry > measurePrevValueDeceasedCountry)
IfTrueAction=[!SetOption MeterValueDeceased MeasureName2 "measureDirIconInc"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
IfCondition2=(measureDeceasedCountry < measurePrevValueDeceasedCountry)
IfTrueAction2=[!SetOption MeterValueDeceased MeasureName2 "measureDirIconDec"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
IfCondition3=(measureDeceasedCountry = measurePrevValueDeceasedCountry)
IfTrueAction3=[!SetOption MeterValueDeceased MeasureName2 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
DynamicVariables=1

[measureRecoveredCountry]
Group=CountryGroup
Measure=WebParser
URL=[measureCountry]
StringIndex=7
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureRecoveredCountry > measurePrevValueRecoveredCountry)
IfTrueAction=[!SetOption MeterValueRecovered MeasureName2 "measureDirIconInc"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
IfCondition2=(measureRecoveredCountry < measurePrevValueRecoveredCountry)
IfTrueAction2=[!SetOption MeterValueRecovered MeasureName2 "measureDirIconDec"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
IfCondition3=(measureRecoveredCountry = measurePrevValueRecoveredCountry)
IfTrueAction3=[!SetOption MeterValueRecovered MeasureName2 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
DynamicVariables=1

[measureConfirmedSource]
Measure=WebParser
URL=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Confirmed%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true
RegExp=(?siU).*\{"value":(.*)\}.*
FinishAction=[!UpdateMeasureGroup ConfirmedGroup][!CommandMeasure measureDeceasedSource "Update"]
OnConnectErrorAction=[!UpdateMeasureGroup ConfirmedGroup][!CommandMeasure measureDeceasedSource "Update"]
OnRegExpErrorAction=[!UpdateMeasureGroup ConfirmedGroup][!CommandMeasure measureDeceasedSource "Update"]
UpdateRate=-1
DynamicVariables=1

[measureConfirmed]
Group=ConfirmedGroup
Measure=WebParser
URL=[measureConfirmedSource]
StringIndex=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureConfirmed > measurePrevValueConfirmed)
IfTrueAction=[!SetOption MeterValueConfirmed MeasureName4 "measureDirIconInc"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
IfCondition2=(measureConfirmed < measurePrevValueConfirmed)
IfTrueAction2=[!SetOption MeterValueConfirmed MeasureName4 "measureDirIconDec"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
IfCondition3=(measureConfirmed = measurePrevValueConfirmed)
IfTrueAction3=[!SetOption MeterValueConfirmed MeasureName4 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueConfirmed][!Redraw]
DynamicVariables=1

[measureDeceasedSource]
Measure=WebParser
URL=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Deaths%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true
RegExp=(?siU).*\{"value":(.*)\}.*
FinishAction=[!UpdateMeasureGroup DeceasedGroup][!CommandMeasure measureRecoveredSource "Update"]
OnConnectErrorAction=[!UpdateMeasureGroup DeceasedGroup][!CommandMeasure measureRecoveredSource "Update"]
OnRegExpErrorAction=[!UpdateMeasureGroup DeceasedGroup][!CommandMeasure measureRecoveredSource "Update"]
UpdateRate=-1
DynamicVariables=1

[measureDeceased]
Group=DeceasedGroup
Measure=WebParser
URL=[measureDeceasedSource]
StringIndex=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureDeceased > measurePrevValueDeceased)
IfTrueAction=[!SetOption MeterValueDeceased MeasureName4 "measureDirIconInc"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
IfCondition2=(measureDeceased < measurePrevValueDeceased)
IfTrueAction2=[!SetOption MeterValueDeceased MeasureName4 "measureDirIconDec"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
IfCondition3=(measureDeceased = measurePrevValueDeceased)
IfTrueAction3=[!SetOption MeterValueDeceased MeasureName4 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueDeceased][!Redraw]
DynamicVariables=1

[measureRecoveredSource]
Measure=WebParser
URL=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Recovered%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true
RegExp=(?siU).*\{"value":(.*)\}.*
FinishAction=[!UpdateMeasureGroup RecoveredGroup]
OnConnectErrorAction=[!UpdateMeasureGroup RecoveredGroup]
OnRegExpErrorAction=[!UpdateMeasureGroup RecoveredGroup]
UpdateRate=-1
DynamicVariables=1

[measureRecovered]
Group=RecoveredGroup
Measure=WebParser
URL=[measureRecoveredSource]
StringIndex=1
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})(\d{3})$":"\1 \2 \3","^(\d+)(\d{3})$":"\1 \2"
IfCondition=(measureRecovered > measurePrevValueRecovered)
IfTrueAction=[!SetOption MeterValueRecovered MeasureName4 "measureDirIconInc"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
IfCondition2=(measureRecovered < measurePrevValueRecovered)
IfTrueAction2=[!SetOption MeterValueRecovered MeasureName4 "measureDirIconDec"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
IfCondition3=(measureRecovered = measurePrevValueRecovered)
IfTrueAction3=[!SetOption MeterValueRecovered MeasureName4 "measureDirIconEqu"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered:]" "#CURRENTPATH#PrevVariables.inc"][!UpdateMeter MeterValueRecovered][!Redraw]
DynamicVariables=1

; ----------------------------------
; Styles
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=8
FontFace=Trebuchet MS
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=255,255,255,205
FontFace=Trebuchet MS
FontSize=8
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=255,255,255,205
FontFace=Trebuchet MS
FontSize=8
AntiAlias=1
ClipString=1
InlineSetting=Color | 255,0,0,255
InlinePattern="(?siU)([measureDirIconInc])"
InlineSetting2=Color | 0,255,0,255
InlinePattern2="(?siU)([measureDirIconDec])"
InlineSetting3=Color | 0,0,255,255
InlinePattern3="(?siU)([measureDirIconEqu])"

[styleSeperator]
SolidColor=255,255,255,15

; ----------------------------------
; METERS
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
X=100
Y=12
W=190
H=18
Text=Coronavirus

[MeterLabelConfirmed]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=28r
W=190
H=14
Text=Confirmés

[MeterValueConfirmed]
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
MeasureName=measureConfirmedCountry
MeasureName2=measureDirIconEqu
MeasureName3=measureConfirmed
MeasureName4=measureDirIconEqu
Text="%1 %2 (%3 %4)"
DynamicVariables=1

[MeterLabelDeceased]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=20r
W=190
H=14
Text=Décédés

[MeterValueDeceased]
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
MeasureName=measureDeceasedCountry
MeasureName2=measureDirIconEqu
MeasureName3=measureDeceased
MeasureName4=measureDirIconEqu
Text="%1 %2 (%3 %4)"
DynamicVariables=1

[meterLabelRecovered]
Meter=String
MeterStyle=styleLeftText
X=10
Y=20r
W=190
H=14
Text=Rétablis

[meterValueRecovered]
Meter=String
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
MeasureName=measureRecoveredCountry
MeasureName2=measureDirIconEqu
MeasureName3=measureRecovered
MeasureName4=measureDirIconEqu
Text="%1 %2 (%3 %4)"
DynamicVariables=1

; [meterSource]
; Meter=String
; MeterStyle=styleLeftText
; ClipString=2
; X=10
; Y=20r
; W=500
; MeasureName=measureConfirmedSource
; MeasureName2=measureDeceasedSource
; MeasureName3=measureRecoveredSource
; Text="%1#CRLF#%2#CRLF#%3"
I removed the @Include2 from the code, as including variables that get written back into the include file is a bit tricky, due to the (usual) need for a !Refresh bang afterwards. I replaced it with parsing the local .inc file with WebParser instead, which yields the same result, but without having to worry about refreshing things or modifying the variables back. I also changed the unicodes into measures that can be reused by changing the MeasureName option in the associated meters, as well as making the country a variable (so you can change it to a different country, if you want to).

I let some things commented there, just in case, but they can be safely deleted. I removed the &outSR=102100 part from the URLs, since it's probably just a meaningless ID of the user that connects to the site, and removing them made the URLs much more similar - in case you find a way to parse the site in a single API query (highly recommended, if possible).

Feel free to adapt it to your needs, or change things back to how they were if you're not happy with the modifications. Also, let me know if it works. It will be problematic to further work on this because of the delays I experience, but I'll give it a try if needed.

P.S. Actually, this one is for everyone who reads it: let me know it the modified skin works for you (you'd need to install the OP's skin and then replace the Covid2019.ini code with this one). Thanks.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Color & data recovery

Post by PtitChat107 »

Yincognito wrote:Ok, so I rewrote the skin to take a different approach ... but experienced significant delays in getting data after a while. I'm not exactly banned, but it takes a while to get the info about the overall sums of Confirmed / Deaths / Recovered, and I also get null values.
I just did the test with your version and I just got the same result as you, I then again did a test with my own version (by relaunching Rainmeter) and it works (well, if I forget my two problems). Regarding the API request, I don't think it is possible, I already had to delve into the depths of the source site codes to find these URLs that work so I doubt that it is easy to get a API without having very good arguments. :???:
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Color & data recovery

Post by balala »

Yincognito wrote: March 9th, 2020, 10:43 am I don't know why you folks seem to think that a WebParser parent is its capture, LOL. It's the second time I see this type of code...
Are you talking about the cases when a WebParser measure use a StringIndex option? If that's right, well, there is nothing wrong with this kind of approach. The parent measure can return certain parsed string and if there is not needed to get more strings, this is the simplest solution to get the only needed string.
User avatar
Yincognito
Rainmeter Sage
Posts: 7130
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Color & data recovery

Post by Yincognito »

PtitChat107 wrote: March 9th, 2020, 3:10 pm I just did the test with your version and I just got the same result as you, I then again did a test with my own version (by relaunching Rainmeter) and it works (well, if I forget my two problems). Regarding the API request, I don't think it is possible, I already had to delve into the depths of the source site codes to find these URLs that work so I doubt that it is easy to get a API without having very good arguments. :???:
Regarding the two problems, this code:

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=
Author=
Information=
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
@include1=UserVariables.inc
@include2=PrevVariables.inc

; ----------------------------------
; MEASURES
; ----------------------------------

[measureConfirmedCountry]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
UpdateRate=300
StringIndex=2
RegExp=(?siU)Country_Region":"France","Last_Update":(.*)...,"Lat":47,"Long_":2,"Confirmed":(.*),"Deaths":(.*),"Recovered":(.*)}
FinishAction=[!EnableMeasure measureConfirmedCountryPrev][!UpdateMeasure measureConfirmedCountryPrev]
Substitute=",":""
RegExpSubstitute=1
[measureConfirmedCountryPrev]
Measure=Calc
Formula=[measureConfirmedCountry]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueConfirmedCountry# > [measureConfirmedCountry]
IfTrueAction=[!SetVariable DirIcon1 "▼"][!SetVariable PrevValueConfirmedCountry "[measureConfirmedCountry]"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueConfirmedCountry# < [measureConfirmedCountry]
IfTrueAction2=[!SetVariable DirIcon1 "▲"][!SetVariable PrevValueConfirmedCountry "[measureConfirmedCountry]"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueConfirmedCountry# = [measureConfirmedCountry]
IfTrueAction3=[!SetVariable DirIcon1 "▬"][!SetVariable PrevValueConfirmedCountry "[measureConfirmedCountry]"][!WriteKeyValue Variables PrevValueConfirmedCountry "[measureConfirmedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureConfirmedCountry2]
Measure=String
String=[measureConfirmedCountry]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

[measureDeceasedCountry]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
UpdateRate=300
StringIndex=3
RegExp=(?siU)Country_Region":"France","Last_Update":(.*)...,"Lat":47,"Long_":2,"Confirmed":(.*),"Deaths":(.*),"Recovered":(.*)}
FinishAction=[!EnableMeasure measureDeceasedCountryPrev][!UpdateMeasure measureDeceasedCountryPrev]
Substitute=",":""
RegExpSubstitute=1
[measureDeceasedCountryPrev]
Measure=Calc
Formula=[measureDeceasedCountry]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueDeceasedCountry# > [measureDeceasedCountry]
IfTrueAction=[!SetVariable DirIcon2 "▼"][!SetVariable PrevValueDeceasedCountry "[measureDeceasedCountry]"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueDeceasedCountry# < [measureDeceasedCountry]
IfTrueAction2=[!SetVariable DirIcon2 "▲"][!SetVariable PrevValueDeceasedCountry "[measureDeceasedCountry]"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueDeceasedCountry# = [measureDeceasedCountry]
IfTrueAction3=[!SetVariable DirIcon2 "▬"][!SetVariable PrevValueDeceasedCountry "[measureDeceasedCountry]"][!WriteKeyValue Variables PrevValueDeceasedCountry "[measureDeceasedCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureDeceasedCountry2]
Measure=String
String=[measureDeceasedCountry]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

[measureRecoveredCountry]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=Confirmed%20%3E%200&spatialRel=esriSpatialRelIntersects&outFields=*
UpdateRate=300
StringIndex=4
RegExp=(?siU)Country_Region":"France","Last_Update":(.*)...,"Lat":47,"Long_":2,"Confirmed":(.*),"Deaths":(.*),"Recovered":(.*)}
FinishAction=[!EnableMeasure measureRecoveredCountryPrev][!UpdateMeasure measureRecoveredCountryPrev]
Substitute=",":""
RegExpSubstitute=1
[measureRecoveredCountryPrev]
Measure=Calc
Formula=[measureRecoveredCountry]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueRecoveredCountry# > [measureRecoveredCountry]
IfTrueAction=[!SetVariable DirIcon3 "▼"][!SetVariable PrevValueRecoveredCountry "[measureRecoveredCountry]"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueRecoveredCountry# < [measureRecoveredCountry]
IfTrueAction2=[!SetVariable DirIcon3 "▲"][!SetVariable PrevValueRecoveredCountry "[measureRecoveredCountry]"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueRecoveredCountry# = [measureRecoveredCountry]
IfTrueAction3=[!SetVariable DirIcon3 "▬"][!SetVariable PrevValueRecoveredCountry "[measureRecoveredCountry]"][!WriteKeyValue Variables PrevValueRecoveredCountry "[measureRecoveredCountry]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureRecoveredCountry2]
Measure=String
String=[measureRecoveredCountry]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

[measureConfirmed]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Confirmed%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&outSR=102100&cacheHint=true
UpdateRate=300
StringIndex=1
RegExp=(?siU)"value":(.*)}
FinishAction=[!EnableMeasure measureConfirmedPrev][!UpdateMeasure measureConfirmedPrev]
Substitute=",":""
RegExpSubstitute=1
[measureConfirmedPrev]
Measure=Calc
Formula=[measureConfirmed]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueConfirmed# > [measureConfirmed]
IfTrueAction=[!SetVariable DirIcon4 "▼"][!SetVariable PrevValueConfirmed "[measureConfirmed]"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueConfirmed# < [measureConfirmed]
IfTrueAction2=[!SetVariable DirIcon4 "▲"][!SetVariable PrevValueConfirmed "[measureConfirmed]"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueConfirmed# = [measureConfirmed]
IfTrueAction3=[!SetVariable DirIcon4 "▬"][!SetVariable PrevValueConfirmed "[measureConfirmed]"][!WriteKeyValue Variables PrevValueConfirmed "[measureConfirmed]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureConfirmed2]
Measure=String
String=[measureConfirmed]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

[measureDeceased]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Confirmed%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Deaths%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true
UpdateRate=300
StringIndex=1
RegExp=(?siU)"value":(.*)}
FinishAction=[!EnableMeasure measureDeceasedPrev][!UpdateMeasure measureDeceasedPrev]
Substitute=",":""
RegExpSubstitute=1
[measureDeceasedPrev]
Measure=Calc
Formula=[measureDeceased]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueDeceased# > [measureDeceased]
IfTrueAction=[!SetVariable DirIcon5 "▼"][!SetVariable PrevValueDeceased "[measureDeceased]"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueDeceased# < [measureDeceased]
IfTrueAction2=[!SetVariable DirIcon5 "▲"][!SetVariable PrevValueDeceased "[measureDeceased]"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueDeceased# = [measureDeceased]
IfTrueAction3=[!SetVariable DirIcon5 "▬"][!SetVariable PrevValueDeceased "[measureDeceased]"][!WriteKeyValue Variables PrevValueDeceased "[measureDeceased]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureDeceased2]
Measure=String
String=[measureDeceased]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

[measureRecovered]
Measure=Plugin
Plugin=WebParser
Url=https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=Recovered%20%3E%200&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Recovered%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&outSR=102100&cacheHint=true
UpdateRate=300
StringIndex=1
RegExp=(?siU)"value":(.*)}
FinishAction=[!EnableMeasure measureRecoveredPrev][!UpdateMeasure measureRecoveredPrev]
Substitute=",":""
RegExpSubstitute=1
[measureRecoveredPrev]
Measure=Calc
Formula=[measureRecovered]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValueRecovered# > [measureRecovered]
IfTrueAction=[!SetVariable DirIcon6 "▼"][!SetVariable PrevValueRecovered "[measureRecovered]"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValueRecovered# < [measureRecovered]
IfTrueAction2=[!SetVariable DirIcon6 "▲"][!SetVariable PrevValueRecovered "[measureRecovered]"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValueRecovered# = [measureRecovered]
IfTrueAction3=[!SetVariable DirIcon6 "▬"][!SetVariable PrevValueRecovered "[measureRecovered]"][!WriteKeyValue Variables PrevValueRecovered "[measureRecovered]" "/PrevVariables.inc"][!UpdateMeter *][!Redraw]
[measureRecovered2]
Measure=String
String=[measureRecovered]
RegExpSubstitute=1
Substitute="^(\d+)(\d{3})$":"\1 \2"
DynamicVariables=1

; ----------------------------------
; Styles
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=8
FontFace=Trebuchet MS
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=255,255,255,205
FontFace=Trebuchet MS
FontSize=8
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=255,255,255,205
FontFace=Trebuchet MS
FontSize=8
AntiAlias=1
ClipString=1
InlineSetting=Color | 255,0,0,255
InlinePattern="(?siU)(▲)"
InlineSetting2=Color | 0,255,0,255
InlinePattern2="(?siU)(▼)"
InlineSetting3=Color | 0,0,255,255
InlinePattern3="(?siU)(▬)"


[styleSeperator]
SolidColor=255,255,255,15

; ----------------------------------
; METERS
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
X=100
Y=12
W=190
H=18
Text=Coronavirus

[MeterLabelConfirmed]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=Confirmés

[MeterValueConfirmed]
Meter=String
MeasureName=measureConfirmedCountry2
MeasureName2=measureConfirmed2
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
DynamicVariables=1
Text=%1 #DirIcon1# (%2 #DirIcon4#)

[MeterLabelDeceased]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=60
W=190
H=14
Text=Décédés

[MeterValueDeceased]
Meter=String
MeasureName=measureDeceasedCountry2
MeasureName2=measureDeceased2
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
DynamicVariables=1
Text=%1 #DirIcon2# (%2 #DirIcon5#)

[MeterLabelRecovered]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=14
Text=Rétablis

[MeterValueRecovered]
Meter=String
MeasureName=measureRecoveredCountry2
MeasureName2=measureRecovered2
MeterStyle=styleRightText
X=200
Y=0r
W=190
H=14
AntiAlias=1
DynamicVariables=1
Text=%1 #DirIcon3# (%2 #DirIcon6#)
solves the color problem (a very simple one, actually), by adding the InlineSetting and InlinePattern options (don't forget the latter) into the [styleRightText] style, and removing them from the !SetOption bangs from your measures.

As for the 2nd problem, I have absolutely no idea why the [measureRecovered] measure is malfunctioning... because it should work. My small contribution to this is to allow the enabling of the [measureRecoveredPrev] measure. Although the issue still remains, at least the measure is enabled by [measureRecovered]. Who knows, maybe this issue is related to my version also having some problems with the last field (i.e. the "recovered" data) - as I said, it would probably help to have just one or maximum two connections to this site, instead of 6 (!) in your version (that's one of the reasons I tried to rewrite the skin in my version).

EDIT: Just solved the 2nd problem as well and updated the above code to reflect that. What I did was just copy paste from the "Confirmed" parts of the skin and use Notepad++'s Replace capability to change "Confirmed" into "Recovered" and "#DirIcon4#" into "#DirIcon6#". I still don't know what on earth was the issue that prevented this part to work, but I don't care anymore, since it finally does.
Last edited by Yincognito on March 9th, 2020, 9:42 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7130
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Color & data recovery

Post by Yincognito »

balala wrote: March 9th, 2020, 5:34 pm Are you talking about the cases when a WebParser measure use a StringIndex option? If that's right, well, there is nothing wrong with this kind of approach. The parent measure can return certain parsed string and if there is not needed to get more strings, this is the simplest solution to get the only needed string.
You're right, technically that approach is not wrong, but it's SO much clearer and cleaner to get the captures in the WebParser child measures instead of the parent ones...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Color & data recovery

Post by PtitChat107 »

Yincognito wrote:Regarding the two problems, this code:
Absolutely perfect, thank you very much and I will try to take your advice into consideration next time ! :givelove:
User avatar
balala
Rainmeter Sage
Posts: 16148
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Color & data recovery

Post by balala »

Yincognito wrote: March 9th, 2020, 9:22 pm You're right, technically that approach is not wrong, but it's SO much clearer and cleaner to get the captures in the WebParser child measures instead of the parent ones...
It doesn't seem so to me. If there is needed only one single string, the single parent measure seems much simpler to me. But each on his own.