It is currently March 28th, 2024, 2:29 pm

MeasureName in Measure

Get help with creating, editing & fixing problems with skins
Post Reply
Ytterbium
Posts: 11
Joined: April 8th, 2017, 11:22 am

MeasureName in Measure

Post by Ytterbium »

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: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

Post by balala »

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

Re: MeasureName in Measure

Post by Ytterbium »

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: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureName in Measure

Post by balala »

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: 11
Joined: April 8th, 2017, 11:22 am

Re: MeasureName in Measure

Post by Ytterbium »

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

Re: MeasureName in Measure

Post by balala »

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

Re: MeasureName in Measure

Post by Ytterbium »

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

Re: MeasureName in Measure

Post by balala »

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

Re: MeasureName in Measure

Post by Ytterbium »

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.
Post Reply