It is currently May 3rd, 2024, 10:02 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

Help to assemble a formula

Post by arcanosa84 »

My doubt is this: this is part of the code in which I have doubts, I have the #Select# variable that can be equal to Internet or Ping depending on the selection.
And I want that when it is Internet, the measure [MeasurePingIP] is completely deactivated and [MeasurePingIE] is activated
and when it is Ping it is the other way around.
I already replaced the value of #Select# with numbers 0 and 1 but I can't get it to work correctly. the measure that is working will be used as the result in [MeasurePing2] for use in the other part of the code.
Gracias y Saludos :welcome: :welcome: :welcome:

Code: Select all

[MeasureStatus]
Measure=Calc
Formula=#Select#
Substitute="Internet":"0","Ping":"1"

[MeasurePingIE]
Measure=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
UpdateDivider=5
IfCondition=(InternetStatus=1)
IfTrueAction=[!SetOptionGroup Pings UpdateRate 0][!UpdateMeasureGroup Pings][!SetOptionGroup Pings UpdateRate 10][!SetVariable Alpha2 #AlphaOn#][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOptionGroup Pings UpdateRate 0][!UpdateMeasureGroup Pings][!SetOptionGroup Pings UpdateRate 5][!SetVariable Alpha2 #AlphaOff#][!UpdateMeter *][!Redraw]
IfCondition2=[MeasureStatus] = 0
IfTrueAction2=[!SetOption Disabled 0]
DynamicVariables=1
Disabled=1

[MeasurePing1]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping01#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha1 ([MeasurePing1]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePingIP]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping02#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha2 ([MeasurePingIP]<1300?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
IfCondition=[MeasureStatus] = 1
IfTrueAction=[!SetOption Disabled 0]
DynamicVariables=1
Disabled=1

[MeasurePing2]
Group=Pings
Measure=Calc
Formula=(MeasureStatus=0?[MeasurePingIE]:(MeasureStatus=1?[MeasurePingIP]:[MeasurePingIE]))

:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help to assemble a formula

Post by balala »

You didn't provide us the whole code, so am not sure (for instance we don't know precisely what values can have the Select variable), however if that variable is set to Internet or Ping (as I figured out by the Substitute option of the [MeasureStatus] measure), the [MeasureStatus] measure can't work, being a Calc measure. Such a Calc measure can only handle numeric values. Strings (like Internet or Ping) are not allowed. If you try to use a string into a Calc measure, the measure simply can't work.
Instead of a Calc measure you should have to use a String measure for such a task. For example:

Code: Select all

[MeasureStatus]
Measure=String
String=#Select#
Substitute="Internet":"0","Ping":"1"
DynamicVariables=1
As you can see besides replacing the type of the measure, I also added a DynamicVariables=1 option, which is needed if the Select variable are set dynamically by !SetVariable bangs.
Another problem: the !SetOption bang used into the IfTrueAction2 option of the [MeasurePingIE] measure (IfTrueAction2=[!SetOption Disabled 0]) can't work, not having the proper number of parameters. Such a !SetOption bang (unlike a !SetVariable) requires at least the following parameters:
  • Section in which you want to set something through the bang (most probably this is missing in this case).
  • The option you want to set (Disabled in this case).
  • The value you want to set to the option added as the previous parameter.
If you set properly the Disabled option of a measure, you can disable it, however a much more natural approach is to use the !DisableMeasure bang. The only parameter required by this bang is the name of the measure which you want to disable.

As a side note: you should have to provide us the whole code, otherwise we can't figure out what did you do in the not posted parts of your code, making helping much difficult.
User avatar
arcanosa84
Posts: 173
Joined: May 21st, 2023, 1:47 am

Re: Help to assemble a formula

Post by arcanosa84 »

[...]

Hello, thanks for answering, let's see I've been learning thanks to the guide of a colleague here but he exhausted himself from continuing to teach me, because I couldn't understand several things. and the manual I understand something but not everything.
I already managed to understand what you were saying about this! DisableMeasure bang but hey, I still have great doubts about how to get the variable to number according to the selected value, that is, Internet or Ping.
I explain what I need.
In this code, which works perfectly, I want to make 2 modifications.
The first

Code: Select all

[MeasurePingIP]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping02#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha2 ([MeasurePingIP]<1300?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePingIC]
Group=Pings
Measure=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=(InternetStatus=1)
UpdateRate=3
;UpdateDivider=5
IfTrueAction=[!SetVariable Alpha2 #AlphaOn#][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable Alpha2 #AlphaOff#][!UpdateMeter *][!Redraw]
DynamicVariables=1
These two variables were called MeasurePing2 and separately they work perfectly, one checks the internet for I and the other for the pc's connectivity. I want to make them work together but not at the same time. That is: #Select# will have only 2 values Internet and Ping, when it is Internet I want MeasurePingIC to be enabled and MeasurePingIP to be disabled, and vice versa.
I know that both control the Alpha2 variable and that's why I thought I would create the MeasurePing2 measure, which is how it was originally, and put the result of the one that is enabled in this condition so that there are no unnecessary calculations, but I've had a lot of trouble understanding how to get from the Internet to 1 and Ping to 0 to achieve the correct calculations. Tell me if I made myself understood here. I publish the complete code so that you understand how you asked me. :welcome: :welcome: :( :D

Code: Select all

[Rainmeter]
Author=AlexSoft
Update=100
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,1

[Variables]
@Include=#ROOTCONFIGPATH#\@Resources\Config\Variables.inc
@Include2=#ROOTCONFIGPATH#\@Resources\Config\Styles.inc
@Include3=#ROOTCONFIGPATH#\@Resources\Config\Links.inc

Milliseconds=#MilisegPing#
Font=#Font5#
FontColor=#Color6#
AlphaOn=255
AlphaOff=#Transparent#
Alpha1=#AlphaOff#
Alpha2=#AlphaOff#
Alpha3=#AlphaOff#
Alpha4=#AlphaOff#
Alpha5=#AlphaOff#
Alpha6=#AlphaOff#
Ping01=#Ping1#
Ping02=#Ping2#
Ping03=#Ping3#
Ping04=#Ping4#
Ping05=#Ping5#
Ping06=#Ping6#
Ping07=#Ping7#
Ping08=#Ping8#
Ping09=#Ping9#
UpdateRate=20

---Measures---

[InternetStatus]
Measure=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
UpdateDivider=5
IfCondition=(InternetStatus=1)
IfTrueAction=[!SetOptionGroup Pings UpdateRate 0][!UpdateMeasureGroup Pings][!SetOptionGroup Pings UpdateRate 10]
IfFalseAction=[!SetOptionGroup Pings UpdateRate 0][!UpdateMeasureGroup Pings][!SetOptionGroup Pings UpdateRate 5]

[MeasurePing1]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping01#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha1 ([MeasurePing1]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePingIP]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping02#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha2 ([MeasurePingIP]<1300?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePingIC]
Group=Pings
Measure=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=(InternetStatus=1)
UpdateRate=3
;UpdateDivider=5
IfTrueAction=[!SetVariable Alpha2 #AlphaOn#][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable Alpha2 #AlphaOff#][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing3]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping03#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha3 ([MeasurePing3]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing4]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping04#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha4 ([MeasurePing4]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing5]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping05#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha6 ([MeasurePing5]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing6]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping06#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha6 ([MeasurePing6]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing7]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping07#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha5 ([MeasurePing7]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing8]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping08#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha5 ([MeasurePing8]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeasurePing9]
Group=Pings
Measure=Plugin
Plugin=PingPlugin
DestAddress=#Ping09#
UpdateRate=#UpdateRate#
OnChangeAction=[!SetVariable Alpha5 ([MeasurePing9]<#Milliseconds#?#AlphaOn#:#AlphaOff#)][!UpdateMeter *][!Redraw]
DynamicVariables=1

---Meters---

[ComputerImage1]
Meter=Image
X=0
Y=0
W=64
H=64
ImageAlpha=#Alpha1#
ImageName=#@#\Images\Ping\Ap.ico
DynamicVariables=1

[ComputerImage2]
Meter=Image
X=10R
Y=0r
W=64
H=64
ImageAlpha=#Alpha2#
ImageName=#@#\Images\Ping\Internet.png
DynamicVariables=1

[ComputerImage3]
Meter=Image
X=10R
Y=0r
W=64
H=64
ImageAlpha=#Alpha3#
ImageName=#@#\Images\Ping\LG Alex.ico
DynamicVariables=1

[ComputerImage4]
Meter=Image
X=10R
Y=0r
W=64
H=64
ImageAlpha=#Alpha4#
ImageName=#@#\Images\Ping\LG Lena.ico
DynamicVariables=1

[ComputerImage5]
Meter=Image
X=10R
Y=0r
W=64
H=64
ImageAlpha=#Alpha5#
ImageName=#@#/Images/Ping/Inv.ico
DynamicVariables=1

[ComputerImage6]
Meter=Image
X=10R
Y=0r
W=64
H=64
ImageAlpha=#Alpha6#
ImageName=#@#\Images\Ping\Laptop.ico
DynamicVariables=1

---Label---

[ComputerLabel1]
Meter=String
X=32
Y=10R
W=64
FontColor=#FontColor#,#Alpha1#
FontEffectColor=0,0,0,#Alpha1#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing1
Text=AP
DynamicVariables=1

[ComputerLabel2]
Meter=String
X=74r
Y=0r
W=64
FontColor=#FontColor#,#Alpha2#
FontEffectColor=0,0,0,#Alpha2#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing2
Text=Internet
DynamicVariables=1

[ComputerLabel3]
Meter=String
X=74r
Y=0r
W=64
FontColor=#FontColor#,#Alpha3#
FontEffectColor=0,0,0,#Alpha3#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing3
Text=Alex
DynamicVariables=1

[ComputerLabel4]
Meter=String
X=74r
Y=0r
W=64
FontColor=#FontColor#,#Alpha4#
FontEffectColor=0,0,0,#Alpha4#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing4
Text=Lena
DynamicVariables=1

[ComputerLabel5]
Meter=String
X=74r
Y=0r
W=64
FontColor=#FontColor#,#Alpha5#
FontEffectColor=0,0,0,#Alpha5#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing7
MeasureName=MeasurePing8
MeasureName=MeasurePing9
Text=Invitado
DynamicVariables=1

[ComputerLabel6]
Meter=String
X=74r
Y=0r
W=64
FontColor=#FontColor#,#Alpha6#
FontEffectColor=0,0,0,#Alpha6#
FontFace=#Font#
FontSize=12
AntiAlias=1
StringEffect=Shadow
StringAlign=Center
MeasureName=MeasurePing5
MeasureName=MeasurePing6
Text=Laptop
DynamicVariables=1
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help to assemble a formula

Post by balala »

I'm sorry but I can't follow what is your intention.
Let1s start all over again, please.
There are the following two measures [InternetStatus] and [MeasurePing1]:
  • The first ([InternetStatus]) is returning the internet connection: 1 if the computer (the specified network adapter, but let1S not complicate things) is connected to internet, -1 if it's not. This is a number and can be used into Calc measures.
  • The second measure ([InternetPing1]) is returning the latency between your computer and the specified host (#Ping01#) in milliseconds. This is also a number and can be treated accordingly.
In your last code there is no Select variable. It was there in the first code, but in the complete code it's not present anymore. How is it set, is still not clear.
My question is what would you like to do when [InternetStatus] is returning any value and what when [MeasurePing1] is returning any value?

A few other things to be taken into account:
  • UpdateRate of any measure supporting this option, can't be 0. This is what you set through the !SetOptionGroup bangs of the IfTrueAction and IfFalseAction options of the last posted [InternetStatus] measure. - NOT TO BE TAKEN INTO ACCOUNT!
  • arcanosa84 wrote: September 6th, 2023, 11:08 pm These two variables were called MeasurePing2 and separately they work perfectly,
    MeasurePing2 is one single measure, not two variables. Using it into the MeasureName option of the [ComputerLabel2] meter, certainly shows it is a measure, not a variable.
  • Even if this is not something which could prevent the skin working, I have to say: you should never, but never set the elements of the @Resources folder as #ROOTCONFIGPATH#\@Resources\ (as you did in the @Include options of the [Variables] section). Instead use the #@# variable. This way the above named three options should look this way:

    Code: Select all

    [Variables]
    @Include=#@#Config\Variables.inc
    @Include2=#@#Config\Styles.inc
    @Include3=#@#Config\Links.inc
    Rainmeter will know where to look for (and find) those files (assuming they exist obviously).
  • Additionally the content of the above three files are unknown, but most probably they are storing some important elements.
So finally you should come back with a few details and let me know exactly and precisely what would you like to achieve, to can help you. I'd like a description of this kind: when measure X is returning 1, and / or measure Y is returning 2, this should happen:... And so on.
Sorry I couldn't follow your description.
User avatar
Yincognito
Rainmeter Sage
Posts: 7196
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

balala wrote: September 7th, 2023, 2:57 pm
  • UpdateRate of any measure supporting this option, can't be 0.
Yes, it can. Here it's used to force update all pings before changing their update frequencies based on internet connectivity.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help to assemble a formula

Post by balala »

Yincognito wrote: September 7th, 2023, 6:01 pm Yes, it can. Here it's used to force update all pings before changing their update frequencies based on internet connectivity.
Alright, you're right, my bad! Sorry, just editing my reply above.
User avatar
Yincognito
Rainmeter Sage
Posts: 7196
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

balala wrote: September 7th, 2023, 7:28 pm Alright, you're right, my bad! Sorry, just editing my reply above.
No problem. :thumbup:
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 »

[...]
Let's see I explain the basic operation.
This skin pings several computers on my local network which have a fixed ip. When a device connects, an image of that device is displayed on the screen and below it the name. It also checks that there is an Internet connection, my connection is metered and it is important to remember when it is connected.
Out of there, what I want to do is the following:
The Select variable is declared in the variables file, and is manually modified using a config skin.
You will be given 2 values, Internet or Ping.
In the code that I published I did not make many changes so that you could better understand the idea, the internet check that is at the beginning is to manipulate the update time of the measurements.
and the MeasurePing... are the meters of each equipment, as you can see there are 2 MeasurePingIP and MeasurePinIC, if I want to check the internet for the connectivity of the pc MeasurePingIC will be used and if I want to check it using the ping to google for example, I would use MeasurePingIP these measures worked one or the other like MeasurePing2.
That is why I want that when Select=Internet MeasurePingIP be disabled and MeasurePingIC enabled and vice versa, when Select=Ping it will be the opposite, I already saw and understood the error when deactivating the measures.
My problem is that I have not been able to take the Select variable to number so that the rest works for me.
that is when Internet = 1 and When Ping = 0

This is how the skin looks on the screen
Resultado final.png
Here the Variable Select can be changed at will
Skin Config.png
I hope you can understand the idea, otherwise guide me to take the Internet and Ping to 1 and 0, which is where my work has been complicated for now. I tried it in several ways, this is one of them:

Code: Select all

[MeasureSelect]
Measure=String
String=#Select#
DynamicVariables=1

[MeasureNumSelect]
MeasureName=MeasureSelect
Substitute="Internet":"1","Ping":"0"
DynamicVariables=1
As I explained, they had already guided me and I have the idea of what I need, but not even with the manual did I get this conversion to work for me and if I don't get it to work, the conditionals don't work well for me, I already did tests and the conditionals with simple numbers, yes. They do what I need, and with the clarification that you gave me on how to deactivate the measure, I already have that almost complete, this step of the conversion from text to number is where I can't get it to work. I'm testing it on a separate skin to see the result on the screen and nothing, I can't.

Code: Select all

[Variables]
@Include=#@#Config\Variables.inc
@Include2=#@#Config\Styles.inc
@Include3=#@#Config\Links.inc
I'm already applying this correction, I saw it on an old skin and that's how I started using it, I didn't know it was wrong, although it worked maybe not entirely well, but I'm already fixing that.
PD: Here comes one of the problems that leave me without thinking, I put the lines in this way and it didn't work for me, I lost the colors, and the fonts that I have programmed in the respective documents, any idea why???

Thank you very much for answering and helping me to finish this project. :thumbup: :thumbup: :thumbup: :welcome:
You do not have the required permissions to view the files attached to this post.
Last edited by eclectic-tech on September 17th, 2023, 6:41 pm, edited 1 time in total.
Reason: When you attach a file, please use 'Place inline' button to position it in the post. You added links to the same images you already attached.
:Whistle :Whistle Learning is the most complete art of life. Just enjoy it. :bow: :bow:
User avatar
balala
Rainmeter Sage
Posts: 16198
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help to assemble a formula

Post by balala »

arcanosa84 wrote: September 7th, 2023, 10:49 pm That is why I want that when Select=Internet MeasurePingIP be disabled and MeasurePingIC enabled and vice versa, when Select=Ping it will be the opposite, I already saw and understood the error when deactivating the measures.
My problem is that I have not been able to take the Select variable to number so that the rest works for me.
that is when Internet = 1 and When Ping = 0
Can the Select variable have other values than Internet or Ping? If these are the only possibilities, the task is quite easy. For instance by adding the following measure to your code:

Code: Select all

[MeasureInternetPing]
Measure=STRING
String=#Select#
RegExpSubstitute=1
Substitute="Internet":"1","Ping":"0"
DynamicVariables=1
The substituted value returned by the above measure is 1 when the Select variable is set to Internet and 0 if the variable is set to Ping (according to the Substitute option). Now you can use this numeric value directly into an IfCondition, to get the proper operation (disabling and enabling the appropriate measures). Add the following options to the above measure:

Code: Select all

[MeasureInternetPing]
Measure=STRING
String=#Select#
RegExpSubstitute=1
Substitute="Internet":"1","Ping":"0"
IfCondition=([#CURRENTSECTION#]=0)
IfTrueAction=[!EnableMeasure "MeasurePingIP"][!DisableMeasure "MeasurePingIC"]
IfFalseAction=[!DisableMeasure "MeasurePingIP"][!EnableMeasure "MeasurePingIC"]
DynamicVariables=1
Note an extremely important detail in the above IfCondition: the option looks this way: IfCondition=([#CURRENTSECTION#]=0). The #CURRENTSECTION# variable (which in this case, since it is used into the [MeasureInternetPing] measure, is resolved as MeasureInternetPing) is included into brackets. This is extremely important to be done, because this ensures you the condition is checking the substituted, numeric value of the measure (respectively 0 or 1). If you miss these brackets (so the option is looking this way: IfCondition=(#CURRENTSECTION#=0)), the condition will always be false, because the IfCondition will try to compare the string (unsubstituted) value of the measure (Internet or Ping) with 0. This never happens, being always false, so the IfFalseAction will be always executed, no matter what is the actual value of the Select variable.

Just to let you see there many times (always?) are more possibilities: instead of using the above IfCondition, you can use two IfMatch options. Add the following options to the above first code (the one not having the IfCondition option):

Code: Select all

[MeasureInternetPing]
Measure=STRING
String=#Select#
IfMatch=Internet
IfMatchAction=[!EnableMeasure "MeasurePingIP"][!DisableMeasure "MeasurePingIC"]
IfMatch2=Ping
IfMatchAction2=[!DisableMeasure "MeasurePingIP"][!EnableMeasure "MeasurePingIC"]
DynamicVariables=1
Which approach do you like more, is absolution up to you. You can use any of them.
Please let me know if my assumption about the possible values of the Select variable is not correct (so, if this variable can have other values than Internet or Ping as well), beacsue such in a case the things are complicating a little bit (but it's not impossible to deal with this either).
User avatar
Yincognito
Rainmeter Sage
Posts: 7196
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help to assemble a formula

Post by Yincognito »

Or, one can avoid conditions and additional bangs altogether
and place the 1st code mentioned by balala before the IP and IC measures, then directly add DynamicVariables=1 to both, as well as Disabled=([MeasureInternetPing]=1?0:1) for the IP measure and Disabled=([MeasureInternetPing]=0?0:1) for the IC measure. Even the simple mathematical Disabled=(1-[MeasureInternetPing]) and Disabled=([MeasureInternetPing]) would have worked, like I was trying to convey to no avail in the other thread, before being "exhausted" by it.

Obviously, if the code isn't available for easy copy pasting, all kinds of so called difficulties arise in implementing literally line by line instructions, despite the badly written manual which has the audacity of not writing the code for the user, or the fact that the user has been spoon fed with similar approaches in entire codes for a whole month. It's curious though how for some folks the manual does its job and they're able to do this from scratch on just their 2nd post as beginners... :Whistle
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth