Page 1 of 1

MeasureName in Measure

Posted: June 10th, 2018, 8:13 pm
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

Re: MeasureName in Measure

Posted: June 10th, 2018, 8:18 pm
by balala
Try to add a DynamicVariables=1 option to the [MesChanged] measure.

Re: MeasureName in Measure

Posted: June 11th, 2018, 10:10 pm
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?

Re: MeasureName in Measure

Posted: June 12th, 2018, 12:17 pm
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.

Re: MeasureName in Measure

Posted: June 12th, 2018, 5:00 pm
by Ytterbium
Sorry :?

Re: MeasureName in Measure

Posted: June 12th, 2018, 5:31 pm
by balala
Ytterbium wrote:Sorry :?
Not sure I understood what you mean. Did my reply help?

Re: MeasureName in Measure

Posted: June 13th, 2018, 5:22 pm
by Ytterbium
Yes it helped, I meant sorry for not seeing in instructions.

Re: MeasureName in Measure

Posted: June 13th, 2018, 5:40 pm
by balala
Ytterbium wrote:Yes it helped, I meant sorry for not seeing in instructions.
Oh, I see. I'm glad I helped.

Re: MeasureName in Measure

Posted: June 14th, 2018, 5:03 pm
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.