The plugin can be downloaded at:
https://github.com/NighthawkSLO/Mouse.dll/releases
Documentation for the plugin can be found at:
https://github.com/NighthawkSLO/Mouse.dll/wiki/Documentation
You can drag the slider or use the mouse wheel to change the volume. Click the icon to toggle mute.
Code: Select all
[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1
[Metadata]
Name=MouseVolume
Author=JSMorley
Information=Demonstrates using the Mouse plugin from NighthawkSLO to create a "slider" | Documentation for the plugin is at https://github.com/NighthawkSLO/Mouse.dll/wiki/Documentation
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=May 18, 2017
[Variables]
VolumeIncrement=1
[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin
IfCondition=MeasureWin7Audio = -1
IfTrueAction=[!SetOption MeterMuteIcon ImageName "volume_mute.png"]
IfFalseAction=[!SetOption MeterSlider X "(([MeasureWin7Audio:] * (200 - 20) / 100) + 20)"][!UpdateMeter *][!Redraw]
IfCondition2=(MeasureWin7Audio = 0)
IfTrueAction2=[!SetOption MeterMuteIcon ImageName "volume_0.png"]
IfCondition3=(MeasureWin7Audio > 0) && (MeasureWin7Audio <= 34)
IfTrueAction3=[!SetOption MeterMuteIcon ImageName "volume_1.png"]
IfCondition4=(MeasureWin7Audio > 34) && (MeasureWin7Audio <= 67)
IfTrueAction4=[!SetOption MeterMuteIcon ImageName "volume_2.png"]
IfCondition5=(MeasureWin7Audio > 67)
IfTrueAction5=[!SetOption MeterMuteIcon ImageName "volume_3.png"]
IfConditionMode=1
; MeasureMouse is the meat and potatoes of creating a slider. MeasurePercent is used to turn the position into a percentage for use various places.
[MeasureMouse]
Measure=Plugin
Plugin=Mouse
LeftMouseDragAction=[!SetOption MeterSlider X "(Clamp($MouseX$,20,200))"][!UpdateMeasure MeasurePercent][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!CommandMeasure MeasureMouse "Stop"]
RelativeToSkin=1
RequireDragging=1
DynamicVariables=1
[MeasurePercent]
Measure=Calc
Formula=[MeterSlider:X]
MinValue=20
MaxValue=200
DynamicVariables=1
IfCondition=MeasureWin7Audio > -1
IfTrueAction=[!CommandMeasure "MeasureWin7Audio" "SetVolume [MeasurePercent:%,0]"]
IfConditionMode=1
[MeterSkinBack]
Meter=Shape
Shape=Rectangle 0.5,0.5,238,75,12 | Fill Color 0,0,0,255 | StrokeWidth 1.5 | Stroke Color 150,150,150,255
W=251
H=76
MouseActionCursor=0
MouseScrollDownAction=[!CommandMeasure MeasureWin7Audio "ChangeVolume -#VolumeIncrement#"][!Update]
MouseScrollUpAction=[!CommandMeasure MeasureWin7Audio "ChangeVolume +#VolumeIncrement#"][!Update]
UpdateDivider=-1
[MeterSlideBack]
Meter=Shape
X=20
Y=20
Shape=Rectangle 0,0,200,10,5 | Fill Color 150,150,150,255 | StrokeWidth 0
[MeterSlideBar]
Meter=Shape
X=20
Y=20
Shape=Rectangle 0,0,[MeterSlider:X],10,5 | Fill Color 56,150,51,255 | StrokeWidth 0
DynamicVariables=1
[MeterSlider]
Meter=Shape
Y=15
Shape=Ellipse 10,10,10,10 | Fill Color 106,222,100,255 | StrokeWidth 0
LeftMouseDownAction=[!CommandMeasure MeasureMouse "Start"]
[MeterPercent]
Meter=String
X=22
Y=45
FontSize=11
FontWeight=700
FontColor=255,255,255,255
Percentual=1
NumOfDecimals=0
AntiAlias=1
DynamicVariables=1
Text=Volume: [MeasurePercent:%,0]%
[MeterMuteIcon]
Meter=Image
X=193
Y=41
W=20
PreserveAspectRatio=1
ImagePath=#@#
LeftMouseUpAction=[!CommandMeasure "MeasureWin7Audio" "ToggleMute"]