It is currently April 24th, 2024, 12:28 am

IF Else Statement using Sound Volume Command Line Tool

Get help with creating, editing & fixing problems with skins
Zorgordian
Posts: 1
Joined: November 1st, 2022, 12:21 pm

IF Else Statement using Sound Volume Command Line Tool

Post by Zorgordian »

Hi all,

Im hoping someone can help tell me why my IF statement isnt loading the correct "mute" image when it detects the microphone is muted. the GetState should return a 1 if the mic is muted or a 0 if it is not. Set State should take that value and check whether Mute group should be loaded or not.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[BaseStyle]
AntiAlias=1
ImageAlpha=130

[HoverStyle]
ImageAlpha=250

[GetState]
Measure=Plugin
Plugin=RunCommand
Parameter='C:\Windows\System32\svcl.exe /stdout /GetMute "LCS_USB_Audio"'
State=Hide
OutputType=ANSI

[SetState]
Measure=Calc
Formula=GetState > 0 ? 1 : 0
IfEqualValue=1
IfEqualAction=[!update][!ShowMeterGroup Mute][!redraw]
IfBelowValue=1
IfBelowAction=[!update][!HideMeterGroup Mute][!redraw]


[MeasureMuteMic] 
Measure=Plugin
Plugin=RunCommand
Parameter='C:\Windows\System32\svv.exe /Mute "LCS_USB_Audio\Device\Microphone\Capture"'
State=Hide
OutputType=ANSI

[MeasureUnMuteMic] 
Measure=Plugin
Plugin=RunCommand
Parameter='C:\Windows\System32\svv.exe /UnMute "LCS_USB_Audio\Device\Microphone\Capture"'
State=Hide
OutputType=ANSI

[Microphone]
meter=Image
ImageName=#ROOTCONFIGPATH#\microphone.png
antialias=1
SolidColor=0,0,0,1
ImageTint=#ImgColor#
x=0
y=0
W=30
H=30
MeterStyle=BaseStyle
Group=Microphone
MouseOverAction=[!SetOption Microphone MeterStyle "BaseStyle | HoverStyle"][!Update]
MouseLeaveAction=[!SetOption Microphone MeterStyle "BaseStyle"][!Update]

;leftmouseupaction=!execute [!CommandMeasure MeasureMuteMic "Run"][!Update][!ShowMeterGroup Mute][!redraw]
leftmouseupaction=!execute [!CommandMeasure MeasureMuteMic "Run"][!Update]
hidden=0

[Mute]
meter=Image
ImageName=#ROOTCONFIGPATH#\mute.png
antialias=1
SolidColor=0,0,0,1
ImageTint=#ImgColor#
x=0
y=0
W=30
H=30
MeterStyle=BaseStyle
Group=Mute
MouseOverAction=[!SetOption Mute MeterStyle "BaseStyle | HoverStyle"][!Update]
MouseLeaveAction=[!SetOption Mute MeterStyle "BaseStyle"][!Update]

;leftmouseupaction=[!CommandMeasure MeasureUnMuteMic "Run"][!Update][!HideMeterGroup Mute][!redraw]
leftmouseupaction=[!CommandMeasure MeasureUnMuteMic "Run"][!Update]

UpdateDivider=-1
OnUpdateAction=[!CommandMeasure MeasureUnMuteMic "Run"][!Update][!HideMeterGroup Mute][!redraw]

hidden=1
Thanks in advance
Zorg