sl23 wrote: ↑June 20th, 2024, 7:50 pm
Thanks, but already tested that and didn't work either!
The Mute status even gets output to a text file, so it shows it gets the required info. Just don't understand it!
What's really odd is that the
OnChangeAction does work but only ocassionally. I tried making the
Timeout longer but has no effect.
Well, I told you the sound tools from NirSoft are not 100% reliable, right? And yep, it happens for me too sometimes (not working).
That being said, the problems in your code go beyond that. Here's an adjusted version (be aware that it's modified, so if something is missing, feel free to add that back - and properly - if needed):
Code: Select all
[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure mRunMicVol "Run"][!CommandMeasure mRunLineVol "Run"][!CommandMeasure mRunMicMute "Run"][!CommandMeasure mRunLineMute "Run"]
SkinHeight=44
[Metadata]
Name=RoundVolume
Author=sl23
Information=Adjust Mic volume.||Credits:||Help via forum: JSMorley, death.crafter, Yincognito.||Thanks to JSMorley for the AudioDeviceList skin. Massive thanks to Yincognito, without whom, this wouldn't have happened!
Version=2024.06.18
License=CC BY 3.0
[Variables]
Aqua=0,255,255
AquaDark=64,191,167,200
AquaDark2=0,255,255,150
Green=128,255,0,220
Orange=255,170,0
Red=255,100,100
Trans=0,0,0,1
White=255,255,255,200
White20=255,255,255,20
White60=255,255,255,60
Yellow=255,255,0,200
BgFill=0,0,0,150
VolBar=64,191,167,200
VolLow=25
VolMax=80
InputStep=5
MicVol=
LineVol=
MicMute=
LineMute=
NAME1=Low
NAME2=Mute
NAME3=Hi
CmdFriendlyIDSyntax=DeviceName\Type\Name\Direction
CmdFriendlyID=USB Audio\Device\Microphone\Capture
Mic=Realtek(R) Audio\Device\Microphone Array\Capture
Line=Realtek(R) Audio\Device\Line In\Capture
---Background---
[Bg]
Meter=Shape
Shape=Rectangle 0,0,170,40,5 | FillColor #BgFill# | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color #White60#
UpdateDivider=-1
X=1
Y=1
---Styles---
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=12
FontColor=#White#
AntiAlias=1
DynamicVariables=1
[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Green#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
[sBar]
BarOrientation=Horizontal
BarColor=#Yellow#
SolidColor=#White60#
DynamicVariables=1
W=150
H=1
---Set Audio In Volume---
[mMicdbLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Input
RMSAttack=50
RMSDecay=300
RMSGain=10
[mDeviceStatus]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceStatus
Substitute="0":"Off","1":"On"
[mDeviceList]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceList
Substitute="}: ":"} "
OnChangeAction=[!Refresh]
[mDeviceName]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceName
IfMatch="#Mic#"
IfMatchAction=[!SetOption MicIcon FontColor "#Green#"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MicIcon FontColor "#White60#"][!UpdateMeter *][!Redraw]
[mDeviceID]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=DeviceID
RegExpSubstitute=1
Substitute="{.*}\.":""
[mDeviceFormat]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicdbLevel
Type=Format
---Get Audio In Status---
[mRunMicVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicVol Formula [mRunMicVol]][!UpdateMeasure MicVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1
[MicVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1
[mRunMicMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Mic#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption MicMute Formula [mRunMicMute]][!UpdateMeasure MicMute][!UpdateMeter *][!Redraw]
DynamicVariables=1
[MicMute]
Measure=Calc
Formula=0
IfCondition=(MicMute=1)
IfTrueAction=[!SetOption MicIcon Text "[\xEC54]"][!SetOption MicIcon FontColor "#Red#"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MicIcon Text "[\xE720]"][!SetOption MicIcon FontColor "#Green#"][!UpdateMeter *][!Redraw]
DynamicVariables=1
[mRunLineVol]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getpercent "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineVol Formula [mRunLineVol]][!UpdateMeasure LineVol][!UpdateMeter *][!Redraw]
RegExpSubstitute=1
Substitute="(?:\s+|[.]\d+)":""
DynamicVariables=1
[LineVol]
Measure=Calc
Formula=0
MinValue=0
MaxValue=100
DynamicVariables=1
[mRunLineMute]
Measure=Plugin
Plugin=RunCommand
Program=#CURRENTPATH#svcl.exe
Parameter=/stdout /getmute "#Line#"
State=Hide
Timeout=250
OutputType=ANSI
FinishAction=[!SetOption LineMute Formula [mRunLineMute]][!UpdateMeasure LineMute][!UpdateMeter *][!Redraw]
DynamicVariables=1
[LineMute]
Measure=Calc
Formula=0
Substitute="0":"UnMuted","1":"Muted"
IfCondition=(LineMute=1)
IfTrueAction=[!SetOption LineIcon Text "[\xEC54]"][!SetOption LineIcon FontColor "#Red#"] [!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption LineIcon Text "[\xE720]"][!SetOption LineIcon FontColor "#Yellow#"] [!UpdateMeter *][!Redraw]
DynamicVariables=1
---METERS---
[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
Text=
LeftMouseUpAction=[Play "#@#Volume\Copy.wav"][!SetClip "; Windows Default Input Device:#CRLF##CRLF#; Device Name: [mDeviceName]#CRLF#; Device ID: [mDeviceID]#CRLF#; Device Format: [mDeviceFormat]#CRLF#; Device Status: [mDeviceStatus]#CRLF##CRLF#; Device List:#CRLF##CRLF#[mDeviceList]"]
MiddleMouseUpAction=[!Refresh]
RightMouseUpAction=[!CommandMeasure mRunMicVol "Run"]
X1MouseUpAction=ms-settings:sound
X2MouseUpAction=[control mmsys.cpl]
ToolTipIcon=Info
ToolTipTitle=[mDeviceName] - [mDeviceStatus]
ToolTipText=L - Copy Device List#CRLF#M - Refresh#CRLF#R - #CRLF#X1 - CP Sound Settings#CRLF#X2 - Main Sound Settings
DynamicVariables=1
X=30
Y=8
[MicPercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Percentual=1
NumOfDecimals=0
Text=#MicVol#
LeftMouseUpAction=[!SetVariable MicVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 25][!CommandMeasure mRunMicVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Mic#"][!CommandMeasure mRunMicMute "Run"][!Update]
RightMouseUpAction=[!SetVariable MicVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Mic#" 80][!CommandMeasure mRunMicVol "Run"][!Update]
TooltipIcon=Info
ToolTipTitle=Mic - [mRunMicMute]
ToolTipText=L - #NAME1##CRLF#M - #NAME2##CRLF#R - #NAME3#
MouseScrollUpAction=[!SetVariable MicVol (Clamp(#MicVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" 5][!CommandMeasure mRunMicVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable MicVol (Clamp(#MicVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Mic#" -5][!CommandMeasure mRunMicVol "Run"][!Update]
DynamicVariables=1
X=25r
Y=-2r
[LineIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe Fluent Icons
FontSize=12
Text=
DynamicVariables=1
X=55r
Y=8
[LinePercent]
Meter=String
MeterStyle=sAllText | sHighlight
FontColor=#White#
Text=#LineVol#
LeftMouseUpAction=[!SetVariable LineVol 25]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 25][!CommandMeasure mRunLineVol "Run"][!Update]
MiddleMouseUpAction=["#CURRENTPATH#SoundVolumeView.exe" /Switch "#Line#"][!CommandMeasure mRunLineMute "Run"][!Update]
RightMouseUpAction=[!SetVariable LineVol 80]["#CURRENTPATH#SoundVolumeView.exe" /SetVolume "#Line#" 80][!CommandMeasure mRunLineVol "Run"][!Update]
TooltipIcon=Info
ToolTipTitle=Line In - [mRunLineMute]
ToolTipText=L - #NAME1##CRLF#M - #NAME2##CRLF#R - #NAME3##CRLF#
MouseScrollUpAction=[!SetVariable LineVol (Clamp(#LineVol#+#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" 5][!CommandMeasure mRunLineVol "Run"][!Update]
MouseScrollDownAction=[!SetVariable LineVol (Clamp(#LineVol#-#InputStep#,0,100))]["#CURRENTPATH#SoundVolumeView.exe" /ChangeVolume "#Line#" -5][!CommandMeasure mRunLineVol "Run"][!Update]
DynamicVariables=1
X=25r
Y=-2r
[MicBar]
Meter=Bar
MeasureName=MicVol
MeterStyle=sBar
BarColor=#Green#
X=11
Y=30
[LineBar]
Meter=Bar
MeasureName=mRunLineVol
MeterStyle=sBar
BarColor=#Yellow#
X=11
Y=34
[LevelBar]
Meter=Bar
MeasureName=mMicdbLevel
MeterStyle=sBar
BarColor=#AquaDark#
X=11
Y=38
I could only test the Mic thing, since I don't have a Line In on my laptop (used to have on my PC back in the day), so that was the focus. I mainly adjusted the measures, didn't touch the meters, so there might be some mistakes left on the latter. Don't forget to set stuff on the MicVol MEASURE and not VARIABLE in the meters, since I used a measure because it was needed for percentual values (you can't have percentual values on a variable, duh).
sl23 wrote: ↑June 20th, 2024, 8:13 pm
OMG!!!
It was the
UpdateDivider=-1! Saw it on some examples you posted and thought it was a good idea to use!
Yep, my bad, I keep forgetting on which measures that is prone to surprises - I knew it's one type of measure, but I keep forgetting which the next time I do it. Will forget it this time too, not a big deal, lol.
P.S. Also, a small observation: you ask too many questions at once or in quick successtion - that, the length and missing details about the code makes things hard to follow. Otherwise, I like your "talkative" nature.