It is currently May 10th, 2024, 5:12 pm

IfCondition Show/Hide MeterImage or MeterGroup

Get help with creating, editing & fixing problems with skins
neo.nemek
Posts: 36
Joined: February 11th, 2023, 7:52 am

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by neo.nemek »

The truth Balala is that I am updating a 2010 Skin that its creator no longer updates or supports, here is the Skin on Devianart: https://www.deviantart.com/jkon00/art/Pog-Pack-160237591
Pog-Pack.jpg
I think it is not forbidden to post links to places where there are Skins and on the other hand I think that to understand the code and what I am doing it was necessary to put the Skin as well as the developer jkon00.
Of course, the code is obsolete and since the skin was published in 2010, but what am I going to tell you? It's a skin that I really like and I wanted to update it, and if I fix it, I'll talk to the original developer to inform him of the improvements to his project.

Now, as you say, Balala, there are obsolete instructions like !Execute, I will have to better understand the Bangs and the Measures, because there is the understanding of Rainmeter.

The previous question about "LeftMouseDownAction" was so that when clicking on an image this action would lead to sliding a TAB of a POD to see, in this case, the Upload and Download graph of the network traffic.
As you can see there are 12 PODS and now I am working with the network POD, Here you have an Example of the first POD and how the developer does to open the TAB of a POD:

Code: Select all

[Tab]
Meter=Image
ImageName=#Graphic#Tab.png
ImageFlip=Horizontal
ImageTint=#Tab Color#
X=188
Y=0
LeftMouseDownAction=!Execute [!RainmeterSetVariable Hide01 1] [!RainmeterSetVariable Hide02 0]
Hidden=#Hide01#
DynamicVariables=1

[TabEnd]
Meter=Image
X=0
Y=0
W=25
H=100
LeftMouseDownAction=!Execute [!RainmeterSetVariable Hide01 0] [!RainmeterSetVariable Hide02 1]
Hidden=#Hide02#
DynamicVariables=1

[TabOpen]
Meter=Image
ImageName=#Graphic#Tab Open.png
ImageFlip=Horizontal
ImageTint=#Tab Color#
X=0
Y=0
Hidden=#Hide02#
DynamicVariables=1
Well I will have to study how to remove the !Execute instruction if you say that it is better to remove it, actually I am rewriting many parts of code and creating new code to improve the Skin, Since I didn't know anything about the Rainmeter code 2 weeks ago, there are my problems with the conditionals and the Measures, but I am improving a lot quickly and I realize that making a solid base of the code and optimizing it is necessary.
I will put the code aside for a few days to better understand IfMatch, IfCondition and other actions, by the way, and as an anecdote I managed to make "LeftMouseDownAction" encapsulating the actions in a Variable, I'll show you:

Code: Select all

IfCondition=(mNetworkIsActive = 1) && (mAdapterType = 6)
IfTrueAction=[!SetOption ImageNetworkPod ImageName "#Graphic#Ethernet POD.png"] [!SetVariable OpenTabGroup "!Execute [!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup NetworkIP][!ShowMeterGroup NetworkGraph]"]
...
As you can see I encapsulate !Execute inside a Variable that I then use below in a METER for the "LeftMouseDownAction=#OpenTabGroup#"
You do not have the required permissions to view the files attached to this post.
User avatar
CodeCode
Posts: 1367
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by CodeCode »

Some of the conditionals can actually be based on an image, instead of a string:

Code: Select all

[MeasureInternet]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
SysInfoData=Best
Disabled=0
RegExpSubstitute=1
Substitute="^1$":"#@#0.png","^-1$":"#@#1.png"

[MeterConnectivity]
Meter=Image
MeasureName=MeasureInternet
AntiAlias=1
X=20
Y=20
At least this idea will save you some head banging over the logic circuit for fall through values and just the amount of easier to read code.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16207
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by balala »

neo.nemek wrote: February 15th, 2023, 11:40 pm The truth Balala is that I am updating a 2010 Skin that its creator no longer updates or supports, here is the Skin on Devianart: https://www.deviantart.com/jkon00/art/Pog-Pack-160237591
Pog-Pack.jpg

I think it is not forbidden to post links to places where there are Skins
It's definitely not. And it's not a problem to update an old skin, it can be done.
neo.nemek wrote: February 15th, 2023, 11:40 pm I'll talk to the original developer to inform him of the improvements to his project.
You can try, but I think you'll have not too much success. But worth trying.
neo.nemek wrote: February 15th, 2023, 11:40 pm Now, as you say, Balala, there are obsolete instructions like !Execute, I will have to better understand the Bangs and the Measures, because there is the understanding of Rainmeter.
neo.nemek wrote: February 15th, 2023, 11:40 pm Well I will have to study how to remove the !Execute instruction if you say that it is better to remove it, actually I am rewriting many parts of code and creating new code to improve the Skin, Since I didn't know anything about the Rainmeter code 2 weeks ago, there are my problems with the conditionals and the Measures, but I am improving a lot quickly and I realize that making a solid base of the code and optimizing it is necessary.
As SilverAzide said in his last reply as well, both, the !Execute bang and the !Rainmeter... bang prefix, are deprecated. You should have to simply remove all occurrences of both. For instance the LeftMouseDownAction=!Execute [!RainmeterSetVariable Hide01 1] [!RainmeterSetVariable Hide02 0] option of the last posted [Tab] meter should be LeftMouseDownAction=[!SetVariable Hide01 "1"][!SetVariable Hide02 "0"]. Note that besides removing the bang and the prefix, I also:
  • Removed the space between the two bangs.
  • Quoted the values which have to be set for the variables.
Even if none of these is absolutely needed, it's a good idea to get the habbit to write the options this way. If for the variable you want to set not a numerical value, but a string and that string contain spaces, the quotes are absolutely needed, without them, the bang doesn't work (or at least doesn't set the proper value for the variable).
For backward compatibility reasons, Rainmeter still works if the deprecated bang and prefix are there, but they should have not be used in fact. This is why we recommended you to remove them.
neo.nemek wrote: February 15th, 2023, 11:40 pm The previous question about "LeftMouseDownAction" was so that when clicking on an image this action would lead to sliding a TAB of a POD to see, in this case, the Upload and Download graph of the network traffic.
As you can see there are 12 PODS and now I am working with the network POD, Here you have an Example of the first POD and how the developer does to open the TAB of a POD:
Sorry, but I can't follow you. I assume by "pod", you mean a skin of this package, but I couldn't find a Network skin. And there are much more than 12 skins in this package. Which skin is exactly the one you're working with? I'd like a path like (this obviously is just an example): PogPack\System\System - Left Tab.ini
neo.nemek wrote: February 15th, 2023, 11:40 pm I will put the code aside for a few days to better understand IfMatch, IfCondition and other actions, by the way, and as an anecdote I managed to make "LeftMouseDownAction" encapsulating the actions in a Variable, I'll show you:

Code: Select all

IfCondition=(mNetworkIsActive = 1) && (mAdapterType = 6)
IfTrueAction=[!SetOption ImageNetworkPod ImageName "#Graphic#Ethernet POD.png"] [!SetVariable OpenTabGroup "!Execute [!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup NetworkIP][!ShowMeterGroup NetworkGraph]"]
...
As you can see I encapsulate !Execute inside a Variable that I then use below in a METER for the "LeftMouseDownAction=#OpenTabGroup#"
This is a perfectly valid procedure and does work. However I have two related comments:
  • The !Execute bang should not be used here either. So, the above IfTrueAction option should be: IfTrueAction=[!SetOption ImageNetworkPod ImageName "#Graphic#Ethernet POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup NetworkIP][!ShowMeterGroup NetworkGraph]"].
  • You have to take care to add a DynamicVariables=1 option to all measures and meter on which you want to use the OpenTabGroup variable, otherwise they won't be able to use the variable. Make sure you add them.
neo.nemek wrote: February 15th, 2023, 11:40 pm but I am improving a lot quickly and I realize that making a solid base of the code and optimizing it is necessary.
Definitely. Feel free to come back anytime with questions, if they arise.
For instance, here is another thing you should update in your code: lately it is recommended to replace the LeftMouseDownAction option with LeftMouseUpAction. In the Note here, you can find out why.
neo.nemek
Posts: 36
Joined: February 11th, 2023, 7:52 am

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by neo.nemek »

@Balala.
I will fix your suggestion about LeftMouseDownAction


Hello again, I already have the finished network monitor POD, it is mostly based on @SilverAzid's code from his Wireless Gadget monitor, I hope SilverAzid doesn't mind that I was inspired by his code to create my POD monitor and if Should it be the case that I can't use parts of your code, I delete it and start another code again.

I understand most of your code and everything works fine for me except that when I am connected to the network via Wireless the POD shows WIFI but signal 0.

Scenario 1: When i turn on my computer I use my wired Ethernet this shows the ethernet.png graph in the POD, when I disable the Ethernet and enable my Wireless and connect to my network via Wireless the POD shows the Wifi.png graph and SignalBar but the SignalBar that shows the signal remain at 0.
Only if I manually refresh the POD Skin.ini myself does the SignalBar refresh and display the correct amount of signal.

Scenario 2: If the skin.ini of the POD has already been manually refreshed when I switch between Ethernet and Wifi, there is no problem and both the SignalBar and the text that show the amount of signal work normally.

I am mentally blocked, I have been studying the SilverAzid code for 1 week and I can't find the way that the first time or every time the Wifi connection is used, the SignalBar is displayed correctly and shows the correct amount of signal.
And keep in mind that the original Jkon code is from 2010 and it sure has a lot of deprecated code.

Code: Select all

[Rainmeter]

Update=1000
Group=NetworkMeter
BackGroundMode=2
SolidColor=0,0,0,1
MiddleMouseDownAction=!RainmeterRefresh

; ====================
[Metadata]

Name=
Author=Neo.Nemek (Jkon and SilverAzid code)
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

; ====================
[Variables]

@Include=#@#UserVariables.inc
@Include2=#@#Variables.inc
@Include3=#@#Translation.inc
@Include4=#@#NetworkVariables.inc

VarPath=#@#NetworkVariables.inc

; dynamic variables; do not change
AdapterFound=0
OpenTabGroup=0

; ====================
; [Styles]

[Text]
FontFace=#Primary Font#
FontSize=#Font Size 4#
FontColor=#Primary Font Color#
StringStyle=#String Style#
StringAlign=Center
Clipstring=1
AntiAlias=1

; ====================
; [Measures]

[MeasureOnLoad]
Measure=Calc
Formula=Counter
IfEqualValue=1
IfEqualAction=[!CommandMeasure MeasureRunGetEthernet "Run"]
UpdateDivider=-1

[CheckAdapterConfigEthernet]
Measure=String
String=#InterfaceEthernet#
RegExpSubstitute=1
Substitute="^(.+)$":"enabled","^$":"disabled"
IfMatch="enabled"
IfMatchAction=[!EnableMeasureGroup "MeasureEthernet"][!UpdateMeasureGroup "MeasureEthernet"][!SetVariable AdapterFound 1]
IfNotMatchAction=[!DisableMeasureGroup "MeasureEthernet"]
UpdateDivider=-1

[CheckAdapterConfigWireless]
Measure=String
String=#InterfaceWireless#
RegExpSubstitute=1
Substitute="^(.+)$":"enabled","^$":"disabled"
IfMatch="enabled"
IfMatchAction=[!EnableMeasureGroup "MeasureWireless"][!UpdateMeasureGroup "MeasureWireless"][!SetVariable AdapterFound 1]
IfNotMatchAction=[!DisableMeasureGroup "MeasureWireless"]
UpdateDivider=-1

;[CheckAdapterConfigBroadband]
;Measure=String
;String=#InterfaceBroadband#
;RegExpSubstitute=1
;Substitute="^(.+)$":"enabled","^$":"disabled"
;IfMatch="enabled"
;IfMatchAction=[!EnableMeasureGroup "MeasureBroadband"][!UpdateMeasureGroup "MeasureBroadband"][!SetVariable AdapterFound 1]
;IfNotMatchAction=[!DisableMeasureGroup "MeasureBroadband"]
;UpdateDivider=-1

; Prior to Windows 10, Windows stored the version number as a string in the form "major.minor"
;   5.0 = Windows 2000
;   5.1 = Windows XP
;   5.2 = Windows XP 64-bit Edition, Windows Server 2003, Windows Server 2003 R2
;   6.0 = Windows Vista, Windows Server 2008
;   6.1 = Windows 7, Windows Server 2008 R2
;   6.2 = Windows 8, Windows Server 2012
;   6.3 = Windows 8.1, Windows Server 2012 R2 -- AND WINDOWS 10 !!
[MeasureOSVersion]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=CurrentVersion
UpdateDivider=-1

; Windows 10 and later stores the version number as two integers, major version and minor version;
; try getting major version and set to zero if OS is prior to Windows 10
;[MeasureOSVersion10andLater]
;Measure=Registry
;RegHKey=HKEY_LOCAL_MACHINE
;RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
;RegValue=CurrentMajorVersionNumber
;RegExpSubstitute=1
;Substitute="^$":"0"
;UpdateDivider=-1

; check if no adapters are configured; if so, attempt to auto-configure
; NOTE: Windows 7 and earlier cannot do auto-configuration; PowerShell query does not work due to no MSFT_NetAdapter namespace
[CalcAdapterConfigCheck]
Measure=Calc
IfCondition=([MeasureOSVersion] > 6.1) && (#AdapterFound# = 0) && (#InterfaceAutoConfig# = 1)
IfTrueAction=[!Log "No network interfaces configured, auto-configuring..." Notice][!SetOption MeterTitleText Text "Configuring..."][!UpdateMeter "MeterTitleText"][!Redraw][!CommandMeasure MeasureRunGetEthernet "Run"]
IfCondition2=([MeasureOSVersion] > 6.1) && (#AdapterFound# = 0) && (#InterfaceAutoConfig# = 0)
IfTrueAction2=[!Log "No network interfaces configured; monitoring active interface only" Notice][!EnableMeasure CalcActiveInterface]
IfCondition3=([MeasureOSVersion] < 6.2) && (#AdapterFound# = 0)
IfTrueAction3=[!Log "No network interfaces configured; monitoring active interface only" Notice][!EnableMeasure CalcActiveInterface]
DynamicVariables=1
UpdateDivider=-1

; if no interfaces configured and autoconfig is not available, monitor the "Best" interface only
[CalcActiveInterface]
Measure=Calc
IfConditionMode=1

IfCondition=(#AdapterFound# = 0) && (MeasureAdapterType <> 71) && (MeasureAdapterType <> 0)
IfTrueAction=IfTrueAction=[!Log "Condition1 Active interface: [MeasureAdapterName] ([MeasureAdapterType])" Notice][!SetVariable InterfaceEthernet ""][!SetVariable InterfaceWireless ""][!SetVariable InterfaceBroadband ""][!DisableMeasureGroup "MeasureEthernet"][!DisableMeasureGroup "MeasureWireless"][!DisableMeasureGroup "MeasureBroadband"][!SetOptionGroup MeasureWireless Reload 1][!UpdateMeasureGroup "MeasureWireless"][!DisableMeasure CalcActiveInterface]

IfCondition2=(#AdapterFound# = 0) && (MeasureAdapterType = 71)
IfTrueAction2=[!Log "Condition2 Active interface: [MeasureAdapterName] ([MeasureAdapterType])" Notice][!SetVariable InterfaceEthernet ""][!SetVariable InterfaceWireless "[MeasureAdapterName]"][!SetVariable InterfaceBroadband ""][!DisableMeasureGroup "MeasureEthernet"][!EnableMeasureGroup "MeasureWireless"][!DisableMeasureGroup "MeasureBroadband"][!SetOptionGroup MeasureWireless Reload 1][!UpdateMeasureGroup "MeasureWireless"][!DisableMeasure CalcActiveInterface]

IfCondition3=(#AdapterFound# = 1)
IfTrueAction3=[!DisableMeasure CalcActiveInterface]
DynamicVariables=1
Disabled=1

;-------------------------------------- Network Graph In/Out ---------------------------------------

[MeasureNetIn]
Measure=NetIn

[MeasureNetOut]
Measure=NetOut

;------------------------------------------ IP Addresses -------------------------------------------

[MeasureIPLan]
Measure=SysInfo
SysInfoType=IP_ADDRESS
DynamicVariables=1
OnChangeAction=[!Log "Internal IP address change, refreshing external IP address" Notice][!CommandMeasure MeasureIPWeb "Reset"][!CommandMeasure MeasureIPWeb "Update"][!UpdateMeasureGroup MeasureActiveNet][!EnableMeasure CalcActiveInterface][!UpdateMeasure CalcActiveInterface]

[MeasureIPWeb]
Measure=WebParser
Url=#UrlExternalIp#
RegExp=#UrlRegExp#
StringIndex=1
ForceReload=1
UpdateRate=-1

;[MeasureIPGateway]
;Measure=SysInfo
;SysInfoType=GATEWAY_ADDRESS
;SysInfoData=#InterfaceWireless#
;DynamicVariables=1

;--------------------------------------ToolTipText SysInfo------------------------------------------

[MeasureComputerName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=COMPUTER_NAME
DynamicVariables=1
AntiAlias=1

[MeasureHostName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=HOST_NAME
DynamicVariables=1
AntiAlias=1

[MeasureUserName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=USER_NAME
DynamicVariables=1
AntiAlias=1

[MeasureOSProductName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=OS_PRODUCT_NAME
DynamicVariables=1
AntiAlias=1

;----------------------------------------- Active Adapter ------------------------------------------

[MeasureAdapterName]
Measure=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
DynamicVariables=1
OnChangeAction=[!Log "Network adapter changed to [MeasureAdapterName], refreshing adapter info" Notice][!UpdateMeasureGroup MeasureActiveNet][!EnableMeasure CalcActiveInterface][!UpdateMeasure CalcActiveInterface]
;
; IMPORTANT:
;   The OnChangeAction is required to refresh all the SysInfo adapter measures when the adapter changes.
;

[MeasureAdapterDisplayName]
Measure=String
String=[MeasureAdapterName]
Group=MeasureActiveNet
RegExpSubstitute=1
Substitute="^0$":"","\(R\)":"","\(TM\)":"","\(tm\)":"","\s\(\d+\)":""
DynamicVariables=1
UpdateDivider=-1

[MeasureAdapterType]
Measure=SysInfo
SysInfoType=ADAPTER_TYPE
Group=MeasureActiveNet
DynamicVariables=1
UpdateDivider=-1

[MeasureInterfaceName]
Measure=SysInfo
SysInfoType=ADAPTER_ALIAS
SysInfoData=#InterfaceWireless#
Group=MeasureActiveNet
RegExpSubstitute=1
Substitute="^0$":""
DynamicVariables=1
UpdateDivider=-1

[MeasureEthernetStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceEthernet#
Group=MeasureEthernet
OnChangeAction=[!Log "Ethernet estatus bien" Notice][!UpdateMeasureGroup MeasureActiveNet]
Disabled=1

[MeasureWirelessStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceWireless#
Group=MeasureWireless
OnChangeAction=[!Log "Wireless estatus bien" Notice][!UpdateMeasureGroup MeasureActiveNet]
Disabled=1

;[MeasureBroadbandStatus]
;Measure=SysInfo
;SysInfoType=ADAPTER_STATE
;SysInfoData=#InterfaceBroadband#
;Group=MeasureBroadband
;OnChangeAction=[!UpdateMeasureGroup MeasureActiveNet]
;Disabled=1

;---------------------------------- Wireless Adapter Signal POD -----------------------------------------

[mBase]
Measure=Calc
Formula=360

[mSignalPos]
Measure=Plugin
Plugin=Plugins\WifiStatus.dll
WifiInfoType=QUALITY
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
MinValue=0
MaxValue=100

[mSignal-]
Measure=Plugin
Plugin=Plugins\WifiStatus.dll
WifiInfoType=QUALITY
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
MinValue=0
MaxValue=100
InvertMeasure=1

;----------------------------------- Wireless Adapter WiFiStatus ---------------------------------------

[MeasureWiFiSSID]
Measure=WiFiStatus
WiFiInfoType=SSID
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
RegExpSubstitute=1
Substitute="^-1$":"#NotConnected#","^0$":"#NoConnection#"
Disabled=1

[MeasureWiFiQuality]
Measure=WiFiStatus
WiFiInfoType=Quality
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
Disabled=1

[MeasureWiFiAuthentication]
Measure=WiFiStatus
WiFiInfoType=AUTH
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
RegExpSubstitute=1
Substitute="^-1$":"","^0$":""
Disabled=1

;[MeasureWiFiEncryption]
;Measure=WiFiStatus
;WiFiInfoType=Encryption
;WiFiIntfID=#WiFiInterfaceID#
;Group=MeasureWireless
;Disabled=1

;[MeasureWiFiBands]
;Measure=WiFiStatus
;WiFiInfoType=PHY
;WiFiIntfID=#WiFiInterfaceID#
;Group=MeasureWireless
;Disabled=1

[MeasureWiFiList]
Measure=WiFiStatus
WiFiInfoType=List
WiFiListStyle=7
Group=MeasureWireless
Disabled=1

;------------------------------------------ Connectivity -------------------------------------------

[MeasureNetworkIsLAN]
Measure=SysInfo
SysInfoType=LAN_CONNECTIVITY

[MeasureNetworkIsWAN]
Measure=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=(MeasureNetworkIsWAN = 1)
IfTrueAction=[!SetVariable InternetFrame 1]
IfFalseAction=[!SetVariable InternetFrame 0]

;---------------------------------------------- Ping -----------------------------------------------

[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=#PingAddress#
UpdateRate=#PingUpdateRate#
Disabled=#HidePing#
; never use DynamicVariables on a Ping plugin measure, use a separate measure if needed

;-------------------------------------------- Commands ---------------------------------------------

; get name of ethernet adapter, then...
[MeasureRunGetEthernet]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 6 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceDescription | Select -First 1).InterfaceDescription""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found ethernet adapter: [MeasureRunGetEthernet]" Notice]
FinishAction=[!SetVariable InterfaceEthernet [MeasureRunGetEthernet]][!WriteKeyValue Variables InterfaceEthernet "[MeasureRunGetEthernet]" "#@#NetworkVariables.inc"][!CommandMeasure MeasureRunGetWireless "Run"]

; ...get name of wireless adapter, then restart
[MeasureRunGetWireless]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "(Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 71 and Virtual = False' -Namespace root\StandardCimv2 | Sort -Property InterfaceDescription | Select -First 1).InterfaceDescription""
OutputType=ANSI
State=Hide
Timeout=10000
Substitute="#CRLF#":""
IfMatch=^.+$
IfMatchAction=[!Log "Found wireless adapter: [MeasureRunGetWireless]" Notice]
FinishAction=[!SetVariable InterfaceWireless [MeasureRunGetWireless]][!WriteKeyValue Variables InterfaceWireless "[MeasureRunGetWireless]" "#@#NetworkVariables.inc"][!WriteKeyValue Variables InterfaceAutoConfig 0 "#@#NetworkVariables.inc"][!Log "Network interface auto-config completed, restarting!" Notice][!Refresh]

;----------------------------- Check Network Status and Select Active Meters ---------------------------

IfCondition=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType = 6)
IfTrueAction=[!SetOption ImageNetworkPod ImageName "#Graphic#Ethernet POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup EthernetTAB][!ShowMeterGroup CommonTAB]"] [!ShowMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition2=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType = 71)
IfTrueAction2=[!SetOption ImageNetworkPod ImageName "#Graphic#Wireless POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup WifiTAB][!ShowMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!ShowMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition3=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType <> 6) && (MeasureAdapterType <> 71)
IfTrueAction3=[!SetOption ImageNetworkPod ImageName "#Graphic#UnkConection POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!HideMeterGroup WifiTAB][!HideMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!ShowMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition4=(MeasureNetworkIsLAN = -1)
IfTrueAction4=[!SetOption ImageNetworkPod ImageName "#Graphic#NoConection POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!HideMeterGroup WifiTAB][!HideMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!ShowMeterGroup "NotConectedPOD"] [!Redraw]



; ====================
; [Meters]

[Base]
Meter=Image
X=0
Y=0
W=300
H=100

[Pod]
Meter=Roundline
MeasureName=mBase
X=200
Y=0
W=100
H=100
LineColor=#Pog Color#
LineLength=50
LineStart=47
StartAngle=0
RotationAngle=6.28318531
AntiAlias=1
Solid=1
ToolTipText=#NetworkPOD#

[TabClosed-Open Network TAB]
Meter=Image
ImageName=#Graphic#Tab.png
ImageFlip=Horizontal
ImageTint=#Tab Color#
X=188
Y=0
LeftMouseDownAction=#OpenTabGroup#
DynamicVariables=1
Hidden=0
Group=6 | All

[TabOpen]
Meter=Image
ImageName=#Graphic#Tab Open.png
ImageFlip=Horizontal
ImageTint=#Tab Color#
X=0
Y=0
DynamicVariables=1
ToolTipText=[MeasureAdapterType] - [MeasureAdapterDisplayName]#CRLF#Int. IP: [MeasureIPLan]#CRLF#Ext. IP: [MeasureIPWeb]#CRLF#Ping: [MeasurePing]ms#CRLF#Wifi SSID: [MeasureWiFiSSID]#CRLF##CRLF##ComputerName#: [MeasureComputerName]#CRLF##NameUser#: [MeasureUserName]#CRLF#OS Ver: [MeasureOSProductName]
Hidden=1
Group=7 | All

[TabOpen-CloseAll]
Meter=Image
X=0
Y=0
W=25
H=100
LeftMouseDownAction=[!RainmeterHideMeterGroup All][!RainmeterShowMeterGroup 6]
DynamicVariables=1
Hidden=1
Group=7 | All

;---------------------------------------- Common POD and TAB Meters -----------------------------------------

;Meter Image Network show into POD
[ImageNetworkPod]
Meter=Image
ImageTint=#Image Color#
X=228
Y=28

;Shows Text internal IP
[InternalIPText]
Meter=String
MeterStyle=Text
X=60
Y=10
FontSize=7
Text=Int IP:
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

;Shows the internal IP
[InternalIPAddress]
Meter=String
Meterstyle=Text
MeasureName=MeasureIPLan
X=80
Y=10
W=180
H=15
FontSize=7
StringAlign=left
Text=%1
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

[NetOut]
Meter=Line
MeasureName=MeasureNetOut
X=75
Y=25
W=122
H=24
LineColor=#Negative Color#
AntiAlias=1
Autoscale=1
Flip=0
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

[NetIn]
Meter=Line
MeasureName=MeasureNetIn
X=r
Y=26r
W=122
H=24
LineColor=#Negative Color#
LineWidth=1
AntiAlias=1
Autoscale=1
Flip=1
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

[NetOutValue]
Meter=String
Meterstyle=Text
MeasureName=MeasureNetOut
X=16
Y=30
W=115
H=15
FontSize=#Font Size 5#
StringAlign=Left
PreFix=UP:
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

[NetInValue]
Meter=String
Meterstyle=Text
MeasureName=MeasureNetIn
X=16
Y=55
W=115
H=15
FontSize=#Font Size 5#
StringAlign=Left
PreFix=DN:
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=CommonTAB | All

;--------------------------------------- Ethernet POD and TAB Meters ----------------------------------------

;Shows Text Host Name
[HostName1TAB]
Meter=String
Meterstyle=Text
X=65
Y=72
FontSize=7
Text=#HostName#
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=EthernetTAB | All

;Shows Host Name
[HostName2TAB]
Meter=String
Meterstyle=Text
MeasureName=MeasureHostName
X=92
Y=72
FontSize=7
StringAlign=left
Text=%1
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=EthernetTAB | All

[EthernetText1POD]
Meter=String
Meterstyle=Text
X=249
Y=18
W=70
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=ETHERNET
AntiAlias=1
Group=EthernetPOD

[EthernetText2POD]
Meter=String
Meterstyle=Text
X=249
Y=72
W=70
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=#Conected#
AntiAlias=1
Group=EthernetPOD

;----------------------------------------- Wifi POD and TAB Meters ----------------------------------------

;Shows Text of SSID of the Wifi connection when open tab
[SSIDLabel]
Meter=String
Meterstyle=Text
x=60
y=75
FontSize=7
Text=SSID:
AntiAlias=1
Hidden=1
Group=WifiTAB | All

;Shows SSID of the Wifi connection when open tab
[MeterSSID]
Meter=String
Meterstyle=Text
MeasureName=MeasureWiFiSSID
x=130
y=75
FontSize=7
Text=%1
AntiAlias=1
DynamicVariables=1
Hidden=1
Group=WifiTAB | All

;Ring that illustrates the status of the Wifi signal
[Signal+POD]
Meter=Roundline
MeterStyle=Pod
MeasureName=mSignalPos
LineColor=#Positive Color#
LineLength=45
LineStart=35
StartAngle=4.73238898
RotationAngle=6.20318531
Group=WifiPOD

;Ring that illustrates the status of the Wifi signal
[Signal-POD]
Meter=Roundline
MeterStyle=Pod
MeasureName=mSignal-
LineLength=45
LineStart=35
LineColor=#Negative Color#
StartAngle=4.69238898
RotationAngle=-6.20318531
Group=WifiPOD

;Wifi signal value
[SignalValuePOD]
Meter=String
MeterStyle=Text
MeasureName=mSignalPos
FontSize=7
X=249
Y=16
W=50
H=15
AntiAlias=1
Group=WifiPOD

;--------------------------------------- Unknown Network POD Meters ----------------------------------------

[UnknownText1]
Meter=String
Meterstyle=Text
X=249
Y=16
W=70
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=#UNKNOWN#
AntiAlias=1
Group=UnknownPOD

[UnknownText2]
Meter=String
Meterstyle=Text
X=249
Y=73
W=70
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=#Connection#
AntiAlias=1
Group=UnknownPOD

;--------------------------------------- No Network POD Meters ----------------------------------------

[NotConectedText1]
Meter=String
Meterstyle=Text
X=249
Y=16
W=70
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=#NETWORK#
AntiAlias=1
Group=NotConectedPOD

[NotConectedText2]
Meter=String
Meterstyle=Text
X=249
Y=73
W=65
H=15
FontSize=6.5
FontColor=White
StringAlign=Center
Text=#NoConnection#
AntiAlias=1
Group=NotConectedPOD



Lastly, I wanted to express that I don't know if someone can use code parts created by other users who do excellent work in their Skins, I hope I don't break or annoy anyone and if it is the case that someone feels annoyed by using code parts, let me know and I delete it without problem, thanks to all for your help
User avatar
balala
Rainmeter Sage
Posts: 16207
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by balala »

neo.nemek wrote: February 20th, 2023, 7:54 am @Balala.
I will fix your suggestion about LeftMouseDownAction
:thumbup:
neo.nemek wrote: February 20th, 2023, 7:54 am Hello again, I already have the finished network monitor POD, it is mostly based on @SilverAzid's code from his Wireless Gadget monitor, I hope SilverAzid doesn't mind that I was inspired by his code to create my POD monitor and if Should it be the case that I can't use parts of your code, I delete it and start another code again.
If I can say in his name, he doesn't mind for sure. Rainmeter skins are mostly realized under Creative Commons Attribution-Non-Commercial-Share Alike 3.0 licence, and as such, you can use any of these codes freely, can alter it. It's a good idea to mention the author of the original code, but you can use it.
Hope SilverAzide agrees me. I'm sure he does, especially that he also wrote similar things. So, I'm sure you can use his code, but finally he is the one who has to say his opinion.
neo.nemek wrote: February 20th, 2023, 7:54 am I understand most of your code and everything works fine for me except that when I am connected to the network via Wireless the POD shows WIFI but signal 0.

Scenario 1: When i turn on my computer I use my wired Ethernet this shows the ethernet.png graph in the POD, when I disable the Ethernet and enable my Wireless and connect to my network via Wireless the POD shows the Wifi.png graph and SignalBar but the SignalBar that shows the signal remain at 0.
Only if I manually refresh the POD Skin.ini myself does the SignalBar refresh and display the correct amount of signal.

Scenario 2: If the skin.ini of the POD has already been manually refreshed when I switch between Ethernet and Wifi, there is no problem and both the SignalBar and the text that show the amount of signal work normally.

I am mentally blocked, I have been studying the SilverAzid code for 1 week and I can't find the way that the first time or every time the Wifi connection is used, the SignalBar is displayed correctly and shows the correct amount of signal.
And keep in mind that the original Jkon code is from 2010 and it sure has a lot of deprecated code.
I let SilverAzide to answer to your question. Hoping he will reply.
neo.nemek wrote: February 20th, 2023, 7:54 am Lastly, I wanted to express that I don't know if someone can use code parts created by other users who do excellent work in their Skins, I hope I don't break or annoy anyone and if it is the case that someone feels annoyed by using code parts, let me know and I delete it without problem, thanks to all for your help
As said above, you can use and alter any of the codes you get on this forum. Maybe mention the author, but you definitely can use them.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2620
Joined: March 23rd, 2015, 5:26 pm

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by SilverAzide »

balala wrote: February 20th, 2023, 1:55 pm
Thanks balala, you are correct...
neo.nemek wrote: February 20th, 2023, 7:54 am
Hi neo.nemek, there's no issue with using my code or any that has been released under a Creative Commons Share-Alike license. You are free to modify and copy as needed; all you need to do is mention the name of the original author (and preferably the source skin or suite) where you got the code.

Without actually running your skin code, I do have some observations for you.

The Gadgets Network Meter (and Wireless Meter) has some code in which it automatically configures itself the first time it runs (i.e., it retrieves the names of your ethernet and wifi adapters). It only needs to do this once. The variable InterfaceAutoConfig controls this; if it is 1, then the auto-config routine will run if no adapters are configured (this will be the case the first time you run the skin). At the end of the code, it sets InterfaceAutoConfig to 0 so this routine won't run a second time. You added a measure, MeasureOnLoad that fires off the automatic configuration code every time the skin loads. I don't see how this skin even works, it should go into an infinite loop at this point, since you are reloading the skin over and over, but perhaps something else is happening. I'd get rid of this measure, it is not needed and may cause errors or crashes.

Next, you added code to the end of the MeasureRunGetWireless measure (the section with the comment "Check Network Status and Select Active Meters"). Are you aware your code is placed at the end of this measure and is part of it? My guess is you placed the code there, discovered it was never running, then added MeasureOnLoad to force it to run? In any case, you need to remove the code from this location, this is not where it needs to be. If you look at your code, it is referencing two measures, MeasureNetworkIsLAN and MeasureAdapterType. So take your entire section of IfConditions and move it to the end of the measure MeasureNetworkIsLAN. This is where it needs to go. Both this measure and MeasureAdapterType are constantly watching your network, and as soon as the network either becomes active or inactive, or if your adapter changes from ethernet to wifi or vice versa, this set of conditions will execute and adjust the appearance of your skin, assuming your IfTrueAction code is working properly.

P.S.: If you want to simulate what happens when the skin loads for the first time, open the NetworkVariables.inc file and blank out the names of your adapters, then set InterfaceAutoConfig=1, the save and refresh. After the skin runs, the adapter name variables will be auto-configured and the auto-config set to 0. Then this code will not run again, as it is not necessary to fetch your adapter names more than once.
Gadgets Wiki GitHub More Gadgets...
neo.nemek
Posts: 36
Joined: February 11th, 2023, 7:52 am

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by neo.nemek »

SilverAzide wrote: February 20th, 2023, 3:29 pm
The Gadgets Network Meter (and Wireless Meter) has some code in which it automatically configures itself the first time it runs (i.e., it retrieves the names of your ethernet and wifi adapters). It only needs to do this once. The variable InterfaceAutoConfig controls this; if it is 1, then the auto-config routine will run if no adapters are configured (this will be the case the first time you run the skin). At the end of the code, it sets InterfaceAutoConfig to 0 so this routine won't run a second time. You added a measure, MeasureOnLoad that fires off the automatic configuration code every time the skin loads. I don't see how this skin even works, it should go into an infinite loop at this point, since you are reloading the skin over and over, but perhaps something else is happening. I'd get rid of this measure, it is not needed and may cause errors or crashes.
Yes this is true, it will take a long time to understand how the network interfaces are added due to its MeasureRunGetEthernet routine and that therefore it is only executed if the InterfaceAutoConfig variable is set to 1, that is, to publish the code installer this variable It must be set to 1 so that after the network monitor skin is installed and loaded, the MeasureRunGetEthernet routine starts for the first time to do its job of defining the network interfaces that the user has and therefore my MeasureOnLoad routine is superfluous and not It needs to be in the code and my intention is to remove MeasureOnLoad. The routine only runs once and sleeps until the Skin.ini is loaded or refreshed.
SilverAzide wrote: February 20th, 2023, 3:29 pm
Next, you added code to the end of the MeasureRunGetWireless measure (the section with the comment "Check Network Status and Select Active Meters").
This code I think I could remove it and take advantage of your ----- Active Adapter ----- routines
This code is responsible for showing or hiding elements of the POD depending on whether the network connection is wired, wireless, unknown, or not connected at all.

Code: Select all

;----------------------------- Check Network Status and Select Active Meters ---------------------------

IfCondition=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType = 6)
IfTrueAction=[!SetOption ImageNetworkPod ImageName "#Graphic#Ethernet POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup EthernetTAB][!ShowMeterGroup CommonTAB]"] [!ShowMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition2=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType = 71)
IfTrueAction2=[!SetOption ImageNetworkPod ImageName "#Graphic#Wireless POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!ShowMeterGroup WifiTAB][!ShowMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!ShowMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition3=(MeasureNetworkIsLAN = 1) && (MeasureAdapterType <> 6) && (MeasureAdapterType <> 71)
IfTrueAction3=[!SetOption ImageNetworkPod ImageName "#Graphic#UnkConection POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!HideMeterGroup WifiTAB][!HideMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!ShowMeterGroup "UnknownPOD"] [!HideMeterGroup "NotConectedPOD"] [!Redraw]

IfCondition4=(MeasureNetworkIsLAN = -1)
IfTrueAction4=[!SetOption ImageNetworkPod ImageName "#Graphic#NoConection POD.png"] [!SetVariable OpenTabGroup "[!HideMeterGroup 6][!ShowMeterGroup 7][!HideMeterGroup WifiTAB][!HideMeterGroup CommonTAB]"] [!HideMeterGroup "EthernetPOD"] [!HideMeterGroup "WifiPOD"] [!HideMeterGroup "UnknownPOD"] [!ShowMeterGroup "NotConectedPOD"] [!Redraw]

Actually all the code together works perfect, this routine of yours controls the network interface changes:

Code: Select all

;----------------------------------------- Active Adapter ------------------------------------------

[MeasureAdapterName]
Measure=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
DynamicVariables=1
OnChangeAction=[!Log "Network adapter changed to [MeasureAdapterName], refreshing adapter info" Notice][!UpdateMeasureGroup MeasureActiveNet][!EnableMeasure CalcActiveInterface][!UpdateMeasure CalcActiveInterface]
;
; IMPORTANT:
;   The OnChangeAction is required to refresh all the SysInfo adapter measures when the adapter changes.
;

[MeasureAdapterDisplayName]
Measure=String
String=[MeasureAdapterName]
Group=MeasureActiveNet
RegExpSubstitute=1
Substitute="^0$":"","\(R\)":"","\(TM\)":"","\(tm\)":"","\s\(\d+\)":""
DynamicVariables=1
UpdateDivider=-1

[MeasureAdapterType]
Measure=SysInfo
SysInfoType=ADAPTER_TYPE
Group=MeasureActiveNet
DynamicVariables=1
UpdateDivider=-1

[MeasureInterfaceName]
Measure=SysInfo
SysInfoType=ADAPTER_ALIAS
SysInfoData=#InterfaceWireless#
Group=MeasureActiveNet
RegExpSubstitute=1
Substitute="^0$":""
DynamicVariables=1
UpdateDivider=-1

[MeasureEthernetStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceEthernet#
Group=MeasureEthernet
OnChangeAction=[!Log "Ethernet estatus bien" Notice][!UpdateMeasureGroup MeasureActiveNet]
Disabled=1

[MeasureWirelessStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceWireless#
Group=MeasureWireless
OnChangeAction=[!Log "Wireless estatus bien" Notice][!UpdateMeasureGroup MeasureActiveNet]
Disabled=1

;[MeasureBroadbandStatus]
;Measure=SysInfo
;SysInfoType=ADAPTER_STATE
;SysInfoData=#InterfaceBroadband#
;Group=MeasureBroadband
;OnChangeAction=[!UpdateMeasureGroup MeasureActiveNet]
;Disabled=1
In fact, if I study the code better, I think I could eliminate my network interface selection code and make better use of its network interface control routine.
Although what I want to fix is ​​that after starting the computer and with the network connection established in Ethernet if I change to Wireless my SignalBar only shows the amount of signal 0 when in reality I have the Wireless signal at 100 and only if I manually refresh the Skin.ini shows the correct amount of signal, after manually updating the skin.ini it doesn't matter if I change to Ethernet or Wireless because it always shows the signal correctly as long as the connection is with Wireless.

I don't know how or where to place a routine that, in addition to controlling the Wireless network connection, automatically refreshes this code and does not fall into an infinite refresh loop of the code that I mention below:

Code: Select all

;---------------------------------- Wireless Adapter Signal POD -----------------------------------------

[mBase]
Measure=Calc
Formula=360

[mSignalPos]
Measure=Plugin
Plugin=Plugins\WifiStatus.dll
WifiInfoType=QUALITY
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
MinValue=0
MaxValue=100

[mSignal-]
Measure=Plugin
Plugin=Plugins\WifiStatus.dll
WifiInfoType=QUALITY
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
MinValue=0
MaxValue=100
InvertMeasure=1

Thanks for your attention and help SilverAzide, and I'm going to remove MeasureOnLoad.
neo.nemek
Posts: 36
Joined: February 11th, 2023, 7:52 am

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by neo.nemek »

This is the complete and functional Skin.ini in case SilverAzid or another user wants to try it and help me with the refresh of the Bar that shows the amount of signal. The texts of the Variables that are shown in the POD are in Spanish since I am Spanish.

You will have to set this variable to 1 as SilverAzid said so that your network interfaces are configured
[Variables]

; network autoconfig, prevents infinite looping
; 0 = don't run autoconfig
; 1 = run autoconfig if all interfaces set to blank
InterfaceAutoConfig=0

Now there are my network interfaces:
InterfaceBroadband=
InterfaceEthernet=Intel(R) Ethernet Connection (11) I219-V
InterfaceWireless=Linksys WUSB6300

Network -Left Tab.rar
You do not have the required permissions to view the files attached to this post.
neo.nemek
Posts: 36
Joined: February 11th, 2023, 7:52 am

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by neo.nemek »

Hello again, I know why it happens that my SignalBar stays at 0 without showing the real amount of Wifi signal, this happens because Rainmeter executes the routine that shows the SignalBar before the Wifi interface is fully connected to the network and results in Wifi signal 0.

This is the routine that permanently knows if the Wifi interface is being used and the SSID when the Wifi is not used SSID return SSID=-1 and SSID=0
I emphasize again that if I refresh the Skin.ini manually the problem does not appear again, it is as if the Wifi goes from SSID=NameOfMySSID state to SSID=-1 state, the problem no longer occurs:

Code: Select all

[MeasureWifiIsConnected]
Measure=WiFiStatus
WiFiInfoType=SSID
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
RegExpSubstitute=1
Disabled=1

[MeasureWirelessStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceWireless#
Group=MeasureWireless
OnChangeAction=[!Log "Wireless estatus bien y [MeasureWirelessStatus] [MeasureWiFiSSID]" Notice][!UpdateMeasureGroup MeasureActiveNet]
Disabled=1

Thinking about how to fix it, I added a condition IfCondition This Condition solves the problem for the [!Refresh] but this action creates a continuous loop:

Code: Select all

[MeasureWifiIsConnected]
Measure=WiFiStatus
WiFiInfoType=SSID
WiFiIntfID=#WiFiInterfaceID#
Group=MeasureWireless
RegExpSubstitute=1
Disabled=1

[MeasureWirelessStatus]
Measure=SysInfo
SysInfoType=ADAPTER_STATE
SysInfoData=#InterfaceWireless#
Group=MeasureWireless
OnChangeAction=[!Log "Wireless estatus bien y [MeasureWirelessStatus] [MeasureWiFiSSID]" Notice][!UpdateMeasureGroup MeasureActiveNet]
IfCondition=(MeasureNetworkIsLAN = 1) && (MeasureWifiIsConnected = 0)
IfTrueAction=[!UpdateMeasureGroup MeasureWireless][!Refresh]
Disabled=1
I really need the Skin.ini to refresh 1 time when the Wifi interface is fully connected to my network and to the SSID=NameOfMySSID due to my little experience with the Rainmeter code, I am putting many hours into this problem to find out why it happens, but I still haven't found an optimal solution. How to refresh the code just one time after completely connecting the wifi network, Well thanks for your attention and help, this problem is killing me
User avatar
SilverAzide
Rainmeter Sage
Posts: 2620
Joined: March 23rd, 2015, 5:26 pm

Re: IfCondition Show/Hide MeterImage or MeterGroup

Post by SilverAzide »

neo.nemek wrote: February 21st, 2023, 4:58 pm Hello again, I know why it happens that my SignalBar stays at 0 without showing the real amount of Wifi signal, this happens because Rainmeter executes the routine that shows the SignalBar before the Wifi interface is fully connected to the network and results in Wifi signal 0.

This is the routine that permanently knows if the Wifi interface is being used and the SSID when the Wifi is not used SSID return SSID=-1 and SSID=0
I emphasize again that if I refresh the Skin.ini manually the problem does not appear again, it is as if the Wifi goes from SSID=NameOfMySSID state to SSID=-1 state, the problem no longer occurs:
Don't try refreshing the skin, that is not the proper fix. The source of the problem lies elsewhere.

One question for you, did you define the variable WiFiInterfaceID? You are using it in your Wifi measures, but I don't see where you defined it. In my skin it was defined at the top of the file, and should be set to 0.

I don't see the purpose of the measures you've added above. You already have all the information you need, and these measures seem to be just duplicating data you already have. Also, the MeasureWifiIsConnected isn't going to work.

You might want to carefully look at the Rainmeter measures on the debug window (Rainmeter > About > Skins > (your skin)). Make sure your measures are enabled and returning values, and watch what happens when you connect/disconnect your adapters.
Gadgets Wiki GitHub More Gadgets...