It is currently April 18th, 2024, 8:55 am

Using measure result as a variable name (variable variable)

Get help with creating, editing & fixing problems with skins
sladek
Posts: 6
Joined: July 7th, 2017, 1:56 pm

Using measure result as a variable name (variable variable)

Post by sladek »

Hi, i'm trying to do something like this:

Code: Select all

[Variables]
wifi1=69000
wifi2=4200
...

[MsNetworkName]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=SSID
IfCondition=MsNetTotal > #[MsNetworkName]#
IfTrueAction=[!WriteKeyValue....
The IfCondition should check if the total net traffic (in B/s) is higher that a total net traffic saved in a variables. If so, it should save it into the variable so i can get the maximum B/s achieved on this network.
But i want to do that for multiple networks, so i need the variable to be "variable" and change depending on the network i am connected to right now.

I tried:
  • #[MsNetworkName]#
    #[&MsNetworkName]#
    #*[MsNetworkName]*#
    #[MsNetworkName:]#
    #([MsNetworkName])#
    #(MsNetworkName)#
and everything returns syntax error.

The solution i came with is

Code: Select all

OnRefreshAction=[!SetOption MsNetworkName IfCondition "MsNetTotal > #*[MsNetworkName]*#"]
in the [Rainmeter] section, it needs to be refreshed on a network change and it isn't "nice". So I'm looking for a better ways.

Any suggestions?
Last edited by sladek on July 20th, 2017, 6:28 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using measure result as a variable name (variable variable)

Post by jsmorley »

You can't embed [SectionVariables] in #Variables#. it just won't work.

Perhaps something like:

Code: Select all

[Variables]
wifi1=69000
wifi2=4200

[MsNetTotal]
Measure=Calc
Formula=5000

[MsNetworkName]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=SSID

[msNetworkSpeed]
Measure=String
String=[MsNetworkName]
Substitute="wifi1":"#wifi1#","wifi2":"#wifi2#"
DynamicVariables=1
IfCondition=[msNetTotal] > [msNetworkSpeed]
IfTrueAction=[!Log "It's greater"]
IfFalseAction=[!Log "It's less"]
I think this will work.