My recommendation is almost similar to eclectic-tech's one, with a small difference. I'd put a Substitute option in the [MeasureAudioDevice] measure, replacing the strings with numbers, then would use an IfCondition statement, to show / hide the appropriate meters. The only bangs which have to be left on the LeftMouseUpAction options of the [MeterHeadset] and [MeterSpeakers] meters are the !CommendMeasures. Also in this case you can hide both meters (adding a
Hidden=1 option to them) from start, because the !ShowMeter / !HideMeter bangs added to the IfTrueAction / IfFalseAction options will show up the right meter:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureAudioDevice]
Measure=Plugin
Plugin=Win7AudioPlugin
Substitute="Speaker/Headphone":"1"
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!HideMeter "MeterHeadset"][!ShowMeter "MeterSpeakers"][!Redraw]
IfFalseAction=[!ShowMeter "MeterHeadset"][!HideMeter "MeterSpeakers"][!Redraw]
[MeterHeadset]
Meter=Image
ImageName=Headphone.png
X=0
Y=0
;W=36
;H=36
LeftMouseUpAction=[!CommandMeasure MeasureAudioDevice "ToggleNext"]
Hidden=1
[MeterSpeakers]
Meter=Image
ImageName=Speaker.png
X=r
Y=r
;W=36
;H=36
LeftMouseUpAction=[!CommandMeasure MeasureAudioDevice "TogglePrevious"]
Hidden=1
Note that you have to complete the Substitute option of the [MeasureAudioDevice] measure, according to the strings returned by the measure on your computer, in both situations.
If you have to use the string values returned by the [MeasureAudioDevice] measure anywhere else in the code, you can add a suplimentar String measure, to can use the IfConditions (or IfMatch) there. Let me know if you want to try my code and don't know how to do this.
eclectic-tech wrote: ↑March 12th, 2019, 4:58 am
This also let's you eliminate skin updates; mouse clicks take care of the updates.
Not too useful for example with my above code, because this prevents the skin to react if you're making a change manually, not by clicking the skin. That's why I used the default
Update=1000.