It is currently May 3rd, 2024, 3:36 pm

Help to assemble a formula

Get help with creating, editing & fixing problems with skins
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

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.
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?
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. :great: :great: :thumbup: :thumbup:

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
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

balala wrote: September 28th, 2023, 8:50 pm Sorry, but can't follow you. You are confusing again the refresh and update operations, which are completely different things. What I think is that you want to refresh the skin when the counter you're talking about reaches 5. If I1m right, and you've followed Yincognito's recommendation, the COUNT function once the skin is loaded, starts counting. This goes on even if you refresh the skin and even if you activates another skin from the same config (obviously assuming there are more skins). To get it restarting from 0 you have to unload the skin, then have to reactivate it. These operations are done by the !DeactivateConfig then !ActivateConfig bangs (in this order, not as you wrote in you reply).
How and for what do you want to use the WebParser measure is completely not clear to me at this moment. So, some additional information are expected here.
Exactly, it's a translation error, but you're right, that's what I want to achieve with the If condition.
Let's see, I made a loop, which counts from 1 to 10 and what I wanted to achieve was that using !Refresh I would refresh a skin that is already loaded, but that condition did not work for me in the IfCondition, that was what I was asking you if it was I could use there.
If I can complete what Yincognito is explaining to me with the webparser I will no longer need this !Refresh option, but it would be good to know if it works in the conditionals. :thumbup:
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
Yincognito
Rainmeter Sage
Posts: 7193
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

arcanosa84 wrote: September 29th, 2023, 12:51 am 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?
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. :great: :great: :thumbup: :thumbup:

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
Well, what can i say - like always, you didn't do the steps I told you and the code is not what I recommended - I don't know why I bother laying out the steps for you. :confused:

It's not that your adaptation using two measures instead of one is wrong in principle, but the steps I described are specifically meant for the single measure approach, and obviously won't suit the two measures variant you put up above - duh.

Try placing the last 5 lines of your 2nd measure into the 1st measure, then get rid of the 2nd measure, and report back the 1st measure value(s) from the About > Skins window while using the exact log file you posted above.

P.S. Capturing the last link status message is indeed what must be done, but the steps I mentioned won't do that (yet), simply because you didn't asked for it. To do that, you should change to:

RegExp=(?siU)^.*?SNMP TRAP \d+: link (\S+)\R.*$
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

Yincognito wrote: September 29th, 2023, 2:07 am Well, what can i say - like always, you didn't do the steps I told you and the code is not what I recommended - I don't know why I bother laying out the steps for you. :confused:

It's not that your adaptation using two measures instead of one is wrong in principle, but the steps I described are specifically meant for the single measure approach, and obviously won't suit the two measures variant you put up above - duh.

Try placing the last 5 lines of your 2nd measure into the 1st measure, then get rid of the 2nd measure, and report back the 1st measure value(s) from the About > Skins window while using the exact log file you posted above.

P.S. Capturing the last link status message is indeed what must be done, but the steps I mentioned won't do that (yet), simply because you didn't asked for it. To do that, you should change to:

RegExp=(?siU)^.*?SNMP TRAP \d+: link (\S+)\R.*$
Let's see, as always, my idea was not to do things wrong, I already had that part set up, and I adapted it with what you gave me, and it worked perfectly, I have it installed with a meter that shows what the webpaser measurement is reading on the screen , but now I did the strict thing you asked me to do to provide you with the information.
Let's see, as always, my idea was not to do things wrong, I already had that part set up, and I adapted it with what you gave me, and it worked perfectly, I have it installed with a meter that shows what the webpaser measurement is reading on the screen , but now I did the strict thing you asked me to do to provide you with the information.
In reality, that information appears in the penultimate line, at least every time I have seen it. And if I didn't discuss it with you, my mistake, I was only telling you to know if it was possible, I never thought that you would give me the solution once and for all.
Image
You do not have the required permissions to view the files attached to this post.
Last edited by arcanosa84 on September 29th, 2023, 2:34 am, edited 1 time in total.
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
Yincognito
Rainmeter Sage
Posts: 7193
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

Also, you should add an IfFalseAction where you unpause the said measure group, just to turn them on if they were previously paused (like it will initially happen, since WebParser doesn't get its data right away, and in that case the measure value will be 0).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

Yincognito wrote: September 29th, 2023, 2:32 am Also, you should add an IfFalseAction where you unpause the said measure group, just to turn them on if they were previously paused (like it will initially happen, since WebParser doesn't get its data right away, and in that case the measure value will be 0).
Yes, because of the if condition, don't worry, I haven't put everything else, I just took that as an option, it worked for me in what I want to stop, I already added it when I put this code in the skin that goes, now I'm just monitoring the results. When everything is ready I put it directly in the skin of the ping graph
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

Yincognito wrote: September 29th, 2023, 2:32 am Also, you should add an IfFalseAction where you unpause the said measure group, just to turn them on if they were previously paused (like it will initially happen, since WebParser doesn't get its data right away, and in that case the measure value will be 0).
Sorry, I did not upload the correct file, since I was testing the router before receiving your message, here it is working correctly. :great: :rosegift:
Image
You do not have the required permissions to view the files attached to this post.
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
Yincognito
Rainmeter Sage
Posts: 7193
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

arcanosa84 wrote: September 29th, 2023, 2:41 am Sorry, I did not upload the correct file, since I was testing with the router, before reviewing your writing, here it is working correctly.
Image
Actually, it's not (yet) working correctly, since the string value should be 1 according to the substitution (looks like another step you didn't follow precisely, I'll let you figure out which one this time):
Link Status.jpg
This is why I told you that when talking code you must be precise to the last letter. A machine doesn't understand if you make a typo, or forget something, or overlook some things when adapting one approach to your own - it will do exactly what it's written, even if you expect otherwise.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

Yincognito wrote: September 29th, 2023, 3:05 am Actually, it's not (yet) working correctly, since the string value should be 1 according to the substitution (looks like another step you didn't follow precisely, I'll let you figure out which one this time):
Link Status.jpg

This is why I told you that when talking code you must be precise to the last letter. A machine doesn't understand if you make a typo, or forget something, or overlook some things when adapting one approach to your own - it will do exactly what it's written, even if you expect otherwise.
This time I don't know whether to be happy that you pressure me to learn or whether to start crying, honestly.
Let's see, although I already do things by myself, with problems of course, but little by little I have been getting the idea of how to work the code, that detail as you call it, I have not read it anywhere yet, and to change one lowercase letter for a capital letter it's terrifying that you left me alone looking for it, but hey, the important thing is that I already achieved it, I checked and it was the only coincidence that could affect it, since I was working on your instructions on how to assemble it and I had been careful not to nothing wrong, but the log generates the text in lowercase and I exchanged it in uppercase.
Thanks, I can now put a function in the ping graph to pause the measurement when the router is disconnected.
Thank you very much for helping me again. :rosegift: :rosegift: :rosegift: :great: :thumbup: :D
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

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.
Now that I have resolved my debt, I'm going to the other part of making the fund with Shape. It would be according to what you tell me. use something like this? Shape=Rectangle 1,1,(#Size#),(#Size#) | Fill Color 255,0,0,255 Of course the color would be transparent, I added color to see it first. Would the variables go in parentheses or not? I tried both ways and it didn't work :confused:

PS: sorry again, it seems that I was tired last night and I didn't realize it, and I hadn't added the line DynamicVariables=1, and today, cooler, I went directly, and it works perfectly, my friend balala may also find that useful information, since it is truly much better than using the Rainmeter section. That was what I was waiting for. It was a whim to know how to handle that type of images, the other planets are separate images. I added a third password-protected sheet. If this is wrong, it returns you to the previous page and if it is good, go to that page. Furthermore, from within the third page, if you go back, another password is written to eliminate the match, and you have to enter it again. I know that it can be changed from the rainmeter files, I only did it to test and learn. Besides, I'm going to use it. As always, I appreciate the guidance you give me. :rosegift: :rosegift: :great: :thumbup:

Code: Select all

[MeterFondoCuadrado]
Meter=Shape
X=5
Y=5
Shape=Rectangle 0,0,(160*#Size#),(160*#Size#) | Fill Color 255,255,255,0 | Stroke Color 255,255,255,0
DynamicVariables=1
Last edited by arcanosa84 on September 29th, 2023, 5:20 pm, edited 2 times in total.
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow: