It is currently May 2nd, 2024, 5:46 am

I can't substitute an empty domain name

Get help with creating, editing & fixing problems with skins
User avatar
haibusa2005
Posts: 52
Joined: June 15th, 2011, 7:23 pm
Location: Bulgaria, Varna

I can't substitute an empty domain name

Post by haibusa2005 »

So here is what I want to accomplish - I get the name of the current domain. If the measure returns no value I want a meter to say that you are not part of a domain. If the returned value is different from nothing, then it's displayed as it is. I have written a similar measure and everything works fine. I guess there is something wrong with the substitute. Here is my code

Working code
[CheckBatteryStatus]
Measure=Calc
Formula=GetBatteryStatus
IfEqualValue=1
IfEqualAction=!SetVariable BatteryCharge "#BatteryCharging#"
IfAboveValue=1
IfAboveAction=!SetVariable BatteryCharge "#BatteryNotCharging#"
IfBelowValue=1
IfBelowAction=!Execute [!HideMeterGroup LaptopDetailedStats] [!ShowMeterGroup DesktopDetailedStats]
Non working code
[Variables]
Domain="Your current domain is %1"
NoDomain="You are not part of a domain"

[GetDomain]
Measure=Plugin
Plugin=SysInfo
SysInfoType=Domain_Name
Substitute="":"1"

[CheckIfConnectedToDomain]
DynamicVariables=1
Measure=Calc
Formula=GetDomain
IfEqualValue=1
IfEqualAction=!SetVariable Domain "#NoDomain#"

[DetailedSystemStatsDesktopDomain]
DynamicVariables=1
Meter=String
MeasureName=GetDomain
FontFace=Calibri
FontSize=14
AntiAlias=1
FontColor=255,255,255,#SystemStatsFadeMain#
ClipString=1
Text=#Domain#
x=235
y=260
h=45
w=300
Group=DesktopDetailedStats
Hidden=1
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: I can't substitute an empty domain name

Post by Kaelri »

Substitutes only change the string value of a measure. So you need to use the string value, rather than the number value. To do this, just put brackets around the measure name:

Code: Select all

[CheckIfConnectedToDomain]
Measure=Calc
DynamicVariables=1
Formula=[GetDomain]
IfEqualValue=1
IfEqualAction=!SetVariable Domain "#NoDomain#"
User avatar
haibusa2005
Posts: 52
Joined: June 15th, 2011, 7:23 pm
Location: Bulgaria, Varna

Re: I can't substitute an empty domain name

Post by haibusa2005 »

I knew I was missing somethinh simple. Thanks a lot :)