It is currently October 17th, 2018, 12:00 am

MeasureName in Measure

Help with creating, editing & fixing problems with skins
Ytterbium
Posts: 9
Joined: April 8th, 2017, 11:22 am

MeasureName in Measure

Ytterbium » June 10th, 2018, 8:13 pm

I'd like to check if a website was updated since I last checked so I have

Code: Select all

[MeasureXMLParent]
Measure=WebParser
UpdateRate=60
URL=file:///C:/Users/Public/Documents/SysInfo.xml
RegExp=Some CrazyLong REGEX
OnConnectErrorAction=[!ToggleMeterGroup Data][!ToggleMeter "Offline"][!SetVariable Error "1"]
OnRegExpErrorAction=[!ToggleMeterGroup Data][!ToggleMeter "NoUpdate"][!SetVariable NoUP "1"]

[MeasureUpdated]
Measure=WebParser
URL=[MeasureXMLParent]
StringIndex=2

[MesChanged]
Measure=String
String=[MeasureUpdated]
IfMatch=#Updated#
IfMatchAction=[!ToggleMeterGroup Data][!ToggleMeter "NoUpdate"][!SetVariable NoUP "1"]
IfNotMatchAction=[!SetVariable Updated MeasureUpdated]
But it does seem to work correctly the [MeasureUpdated] is not converted to string for comparision
User avatar
balala
Rainmeter Sage
Posts: 6816
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

balala » June 10th, 2018, 8:18 pm

Try to add a DynamicVariables=1 option to the [MesChanged] measure.
Ytterbium
Posts: 9
Joined: April 8th, 2017, 11:22 am

Re: MeasureName in Measure

Ytterbium » June 11th, 2018, 10:10 pm

I tweeked it a bit to make it simpler:

Code: Select all

[MeasureUpdated]
Measure=WebParser
DynamicVariables=1
URL=[MeasureXMLParent]
StringIndex=2
;OnUpdateAction=[!Log "Updated"]
IfCondition=#Updated# = MeasureUpdated
IfTrueAction=[!Log "True"]
;IfTrueAction=[!HideGroup Data][!ToggleMeter "NoUpdate"]
IfFalseAction=[!Log "False"]
;IfFalseAction=!SetVariable Updated [MeasureUpdated]
I can see that the code is run at the update interval but the IfCondition is not evaluated on each update only if the #Updated# is updated?
User avatar
balala
Rainmeter Sage
Posts: 6816
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

balala » June 12th, 2018, 12:17 pm

Ytterbium wrote:I can see that the code is run at the update interval but the IfCondition is not evaluated on each update only if the #Updated# is updated?
In such cases when the condition become true, the IfTrueAction is executed, but for a new execution, the condition has to become false first, then true again. To avoid this, you can add an IfConditionMode=1 option to the [MeasureUpdated] measure. In this case the IfTrueAction is executed on every update cycle, if the condition is met.
Ytterbium
Posts: 9
Joined: April 8th, 2017, 11:22 am

Re: MeasureName in Measure

Ytterbium » June 12th, 2018, 5:00 pm

Sorry :?
User avatar
balala
Rainmeter Sage
Posts: 6816
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

balala » June 12th, 2018, 5:31 pm

Ytterbium wrote:Sorry :?
Not sure I understood what you mean. Did my reply help?
Ytterbium
Posts: 9
Joined: April 8th, 2017, 11:22 am

Re: MeasureName in Measure

Ytterbium » June 13th, 2018, 5:22 pm

Yes it helped, I meant sorry for not seeing in instructions.
User avatar
balala
Rainmeter Sage
Posts: 6816
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

balala » June 13th, 2018, 5:40 pm

Ytterbium wrote:Yes it helped, I meant sorry for not seeing in instructions.
Oh, I see. I'm glad I helped.
Ytterbium
Posts: 9
Joined: April 8th, 2017, 11:22 am

Re: MeasureName in Measure

Ytterbium » June 14th, 2018, 5:03 pm

Yes, super I got a working script that allows me to migrate from the windows Gadgets.

I added the functionality to throw the errors if the computer is offline or the local tool that I coded crashes.