I already did all the steps that you told me about, and it worked perfectly until I updated the log. I imagine that by not passing a more extensive log, I was missing information, since I tried the extract that I sent you previously and it works perfectly, changing Link Up and Link Down manually, but the log outputs a large group of information and it must capture the last one according to the message, it outputs 3 lines in three lines, what correction should I make so that it works perfectly?Yincognito wrote: ↑September 28th, 2023, 8:28 pm A variable written directly can be used, obviously, but it won't mean anything if it's not determined by the actual router status. However, if you can set the router to save its log file automatically AND it doesn't do it in a write exclusive mode, then yes, as you correctly suspected, WebParser can be used to grab the status on that line and use it further. As for the guidance, you need to:
- create a simple WebParser measure retrieving your LOCAL log file
- add RegExp=(?siU)SNMP TRAP \d+: link (\S+)\R and StringIndex=1 to it
- add a Substitute to convert its "up" and "down" to "1" and "0"
- add an IfCondition to do what you want based on its value
- add a FinishAction=[!UpdateMeasure ThisMeasure] to force running the condition when the measure gets its value
The rest is entirely up to you and what you want to do with that value.
Regarding escaping variables, if your code in what I linked to in my previous reply worked (as in tinting the images to Venus
colors, or to Tierra colors if you set your planet to it, updated the meters and redrew) - and i don't see a reason why it didn't work, then so should any similar approaches, if you do them correctly (which you did in that code, as far as the syntax was concerned).
By the way, if you were using a Shape meter to create your skin background and you were defining the dimensions of that shape using similar variables (that is, not involving the [Rainmeter] section in all this), then you would be able to set your "skin size" dynamically (and without refreshing, just updating meters and redrawing). Again, it's up to you to put this info to good use.
This is an example of the most complete log, there is an intermediate disconnection so you can see how it comes out, and the final message is repeated and repeated.
And the code as you recommended me.
Code: Select all
[Rainmeter]
Update=50
[Variables]
@Include=#@#\Config\Variables.inc
@Include2=#@#\Config\Styles.inc
@Include3=#@#\Config\Links.inc
[MeasureRouter]
Measure=WebParser
URL=file://#@#\Tp-Link\Tp-Link.txt
RegExp=(?siU)SNMP TRAP \d+: link (\S+)\R
StringIndex=1
FinishAction=[!UpdateMeasure MeasureRouter]
[MeasureStatus]
Measure=STRING
String=MeasureRouter
RegExpSubstitute=1
Substitute="Up":"1","Down":"0"
IfCondition=([#CURRENTSECTION#]=0)
IfTrueAction=[!PauseMeasureGroup Pings]
DynamicVariables=1
- 1/1/2000 3:42:52> adjTimeTask fail: id = 6, ip = 81060f1c
1/1/2000 3:42:52> sending request to NTP server(343f)
1/1/2000 3:43:12> Connect() to NTP server fail
1/1/2000 3:43:12> adjTimeTask fail: id = 7, ip = 81060f1d
1/1/2000 3:43:12> sending request to NTP server(3453)
1/1/2000 3:43:32> Connect() to NTP server fail
1/1/2000 3:43:32> adjTimeTask fail: id = 8, ip = 76a3513e
1/1/2000 3:43:32> sending request to NTP server(3467)
1/1/2000 3:43:34> netMakeChannDial: err=-3000 rn_p=804687d8
1/1/2000 3:43:52> Last errorlog repeat 5 Times
1/1/2000 3:43:52> Connect() to NTP server fail
1/1/2000 3:43:52> adjTimeTask fail: id = 9, ip = d316679d
1/1/2000 3:43:52> sending request to NTP server(347b)
1/1/2000 3:43:54> netMakeChannDial: err=-3000 rn_p=804687d8
1/1/2000 3:44:12> Last errorlog repeat 2 Times
1/1/2000 3:44:12> Connect() to NTP server fail
1/1/2000 3:44:12> adjTimeTask fail: id = 10, ip = 76a3513d
1/1/2000 3:44:12> adjTimeTask fail: no server available
1/1/2000 3:44:12> adjtime task pause 1 day
1/1/2000 3:44:53> netMakeChannDial: err=-3000 rn_p=804687d8
1/1/2000 3:45:12> Last errorlog repeat 108 Times
1/1/2000 3:45:12> sending request to NTP server(34cb)
1/1/2000 3:45:12> netMakeChannDial: err=-3000 rn_p=804687d8
1/1/2000 3:45:17> Last errorlog repeat 55 Times
1/1/2000 3:45:17> received from NTP server(34d0)
9/28/2023 13:51:29> Adjust time to 651584e1
9/28/2023 13:51:29> adjtime task pause 1 day
9/28/2023 13:51:29> netMakeChannDial: err=-3000 rn_p=804687d8
9/28/2023 19:40:33> Last errorlog repeat 8363 Times
9/28/2023 19:40:33> ADSL: down
9/28/2023 19:40:34> MPOA Link Down
9/28/2023 19:40:34> SNMP TRAP 2: link down
9/28/2023 19:40:34> Last errorlog repeat 6 Times
9/28/2023 19:40:34> netMakeChannDial: err=-3001 rn_p=804687d8
9/28/2023 19:42:41> Last errorlog repeat 77 Times
9/28/2023 19:42:41> ADSL: initializing
9/28/2023 19:42:41> netMakeChannDial: err=-3001 rn_p=804687d8
9/28/2023 19:42:54> Last errorlog repeat 81 Times
9/28/2023 19:42:54> ADSL: UP
9/28/2023 19:42:55> netMakeChannDial: err=-3001 rn_p=804687d8
9/28/2023 19:42:55> Last errorlog repeat 2 Times
9/28/2023 19:42:55> MPOA Link Up
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> Last errorlog repeat 1 Times
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> Quick bridge not allow multi-channel
9/28/2023 19:42:55> bridge only stop
9/28/2023 19:42:55> SNMP TRAP 3: link up
9/28/2023 19:42:55> netMakeChannDial: err=-3000 rn_p=804687d8