Page 1 of 2

Volume control.

Posted: May 15th, 2018, 9:24 pm
by kyriakos876
I'm sure I have seen this in another post but I can't find it again so I'm asking how can I set the volume up or down using commands? I want this to show when I click on a meter for example:
Untitled.png
and raise or lower the volume.

-Thanks in advance.

Re: Volume control.

Posted: May 16th, 2018, 12:28 am
by eclectic-tech

Code: Select all

[Rainmeter]
Update=100
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,1

[Variables]
VolumeIncrement=1

[MeasurePlayer]
Measure=Plugin
Plugin=Win7AudioPlugin.dll
MinValue=0
MaxValue=100

[MeasureVolume%]
Measure=Calc
Formula=MeasurePlayer
MinValue=0
MaxValue=100
UpdateDivider=1

[MeasureSetVolumeLevel]
Measure=Calc
Formula=#VolumeLevel#
DynamicVariables=1

[Volume]
Meter=Bar
BarOrientation=Vertical
MeasureName=MeasurePlayer
BarColor=0,0,0
SolidColor=255,255,255
x=5
y=0
W=10
H=100
LeftMouseUpAction=[!SetVariable VolumeLevel "(100-$MouseY:%$)"][!Update][!CommandMeasure "MeasurePlayer" "SetVolume [MeasureSetVolumeLevel]"]
MouseScrollDownAction=[!CommandMeasure MeasurePlayer "ChangeVolume -#VolumeIncrement#"][!Update]
MouseScrollUpAction=[!CommandMeasure MeasurePlayer "ChangeVolume +#VolumeIncrement#"][!Update]
DynamicVariables=1

[MeterVolumeLevel]
MeasureName=MeasureVolume%
Meter=STRING
X=-5r
Y=3R
FontColor=220,220,220
SolidColor=0,0,0,1
FontEffectColor=0,0,0
StringEffect=Shadow
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1%
DynamicVariables=1
vertvol.png

Re: Volume control.

Posted: May 16th, 2018, 5:23 am
by CyberTheWorm
My take

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1

[Metadata]
Name=Volume Control
Author=CyberTheWorm
Information=System Volume control, thanks to Seahorse for code on getting volume bars to work the way I want
Version=1.0.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

;-------------------- Variables ----------------------
[Variables]
[Variables]
;General 
MyFont=Arial
MyFontSize=10
MyFontColor=126,217,241,255
MyEffect=Shadow
MyEffectColor=69,150,221,255


;--------------------- Measures ----------------------
[MeasureVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeasureSystemVolume]
Measure=Calc
Formula=MeasureVolume
OnChangeAction=[!CommandMeasure "MeasureVolume" "SetVolume [MeasureSystemVolume]"][!UpdateMeasure MeasureVolume][!UpdateMeter MeterSystemVolumeBar][!Redraw]
MaxValue=100
UpdateDivider=-1

;---------------------- Meters -------------------------
[MeterSystemVolumeBar]
Meter=Bar
MeasureName=MeasureVolume
BarImage=#@#\Images\VBar.png
X=100
Y=0
SolidColor=255,255,255,100
BarOrientation=Vertical
DynamicVariables=1
LeftMouseUpAction=[!SetOption MeasureSystemVolume Formula "(100-$MouseY:%$)"][!UpdateMeasure MeasureSystemVolume]
ToolTipText=Left Mouse click to set system volume

[MeterVolumePercent]
Meter=String
X=5r
Y=105r
FontFace=#MyFont#
FontSize=#MyFontSize#
FontColor=#MyFontColor#
StringEffect=#MyEffect#
FontEffectColor=#MyEffectColor#
StringAlign=Center
AntiAlias=1
Text=[MeasureVolume:]%
DynamicVariables=1
LeftMouseUpAction=!CommandMeasure "MeasureVolume" "ToggleMute"

[MeterDeviceName]
Meter=String
MeasureName=MeasureVolume
X=0r
Y=15r
W=70
FontFace=#MyFont#
FontSize=#MyFontSize#
FontColor=#MyFontColor#
StringEffect=#MyEffect#
FontEffectColor=#MyEffectColor#
StringAlign=Center
AntiAlias=1
ClipString=2
DynamicVariables=1
LeftMouseUpAction=!CommandMeasure "MeasureVolume" "ToggleNext"
VBar.png

Re: Volume control.

Posted: May 16th, 2018, 9:31 am
by kyriakos876
So I suppose the skin I saw back then was just a good replica of wibdow's volume bar? Is it possible to control the volume with powershell or cmd commands?

Re: Volume control.

Posted: May 16th, 2018, 12:32 pm
by balala
kyriakos876 wrote:So I suppose the skin I saw back then was just a good replica of wibdow's volume bar? Is it possible to control the volume with powershell or cmd commands?
Why would you? The Win7Audio plugin can easily change the volume. It can be used to increase / decrease the volume with certain percent, to set it to a well specified level, to mute or unmute the system and so on. Why wouldn't you use this plugin, instead of a using some command / PowerShell?

Re: Volume control.

Posted: May 16th, 2018, 12:56 pm
by jsmorley
https://forum.rainmeter.net/viewtopic.php?p=136100#p136100

I can't picture any possible reason why I wouldn't use Win7AudioPlugin. Loading and executing some external program on every tiny incremental change in the volume as you increase or decrease it would just be horrifyingly inefficient.

Re: Volume control.

Posted: May 17th, 2018, 11:52 am
by kyriakos876
The idea is to use the already existing UI elements of windows 10. My keyboard has Up/Down volume buttons that will pop-up this bar I shared above in the screenshot, and increase/lower the volume. I'd like to send a command and simulate the behavior of my keyboard buttons. You might be wondering "why wouldn't you just press those buttons?" well, leave that to me. I'm just asking if there's a command will "call" this bar on the top left corner while changing the volume.

Re: Volume control.

Posted: May 17th, 2018, 12:08 pm
by balala
kyriakos876 wrote:The idea is to use the already existing UI elements of windows 10. My keyboard has Up/Down volume buttons that will pop-up this bar I shared above in the screenshot, and increase/lower the volume. I'd like to send a command and simulate the behavior of my keyboard buttons. You might be wondering "why wouldn't you just press those buttons?" well, leave that to me. I'm just asking if there's a command will "call" this bar on the top left corner while changing the volume.
I don't think that's needed. When you press those buttons (I usually also do so), that UI element is popping up, but if you have an appropriate Rainmeter skin, which uses the Win7AudioPlugin, this also will interact and show the changed volume, without having to create / use any weird command or PowerShell.

Re: Volume control.

Posted: May 17th, 2018, 12:49 pm
by eclectic-tech
kyriakos876 wrote:The idea is to use the already existing UI elements of windows 10. My keyboard has Up/Down volume buttons that will pop-up this bar I shared above in the screenshot, and increase/lower the volume. I'd like to send a command and simulate the behavior of my keyboard buttons. You might be wondering "why wouldn't you just press those buttons?" well, leave that to me. I'm just asking if there's a command will "call" this bar on the top left corner while changing the volume.
If I understand your reply, this is not a Rainmeter skin. If it were, then balala is correct that it will react to changes to the volume without needing to do anything; you could create a skin that only shows for a few seconds when the volume changes to mimic what you are describing.

The MediaKey measure can simulate key presses for a few media players, but I don't think that is what you are looking for.

I think you would need to ask the creator of that media interface. I am unaware of any Win10 UI media elements that Rainmeter can access.

Re: Volume control.

Posted: May 17th, 2018, 1:01 pm
by kyriakos876
eclectic-tech wrote:If I understand your reply, this is not a Rainmeter skin. If it were, then balala is correct that it will react to changes to the volume without needing to do anything; you could create a skin that only shows for a few seconds when the volume changes to mimic what you are describing.

The MediaKey measure can simulate key presses for a few media players, but I don't think that is what you are looking for.

I think you would need to ask the creator of that media interface. I am unaware of any Win10 UI media elements that Rainmeter can access.
Actually, MediaKey is exactly what I was looking for... when this action LeftMouseUpAction=!CommandMeasure "MeasureMediaKey" "VolumeMute" is commanded, it will actually pop-up the little bar on the left corner. Thanks, I was unaware of this Measure! (I thought I read all the measures back in the day, but apparently I missed something)