Demonstrating the Mouse plugin

Post your work-in-progress and completed skins to share and discuss.
User avatar

Demonstrating the Mouse plugin

May 19th, 2017, 3:47 am
jsmorley
Developer   [15733 posts]

This skin will demonstrate using the Mouse plugin created by NighthawkSLO to create a "slider", in this case used to control the system volume.

Documentation for the plugin can be found at:

https://github.com/NighthawkSLO/Mouse.dll/wiki/Documentation

MouseVolume_1.0.rmskin
(240.23 KiB) Downloaded 38 times


You can drag the slider or use the mouse wheel to change the volume. Click the icon to toggle mute.
gif.gif


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"]
User avatar

Re: Demonstrating the Mouse plugin

May 19th, 2017, 8:53 am
balala
Rainmeter Sage   [4339 posts]

I don't contest a such plugin would be helpful in many cases, however a slider can be created even without any plugin.
User avatar

Re: Demonstrating the Mouse plugin

May 19th, 2017, 9:01 am
khanhas
   [13 posts]

Glad Nighthawk officially released Mouse.dll. This plugin has endless possibilities and is really fun to play around.
I don't know should I open another thread so I just post it here and hope communities find this plugin interesting and start making more interactive skins.
Here another volume changer but this time it's round.

Image

Code: Select all

[Rainmeter]
Update=16
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!Draggable 0]

[Variables]
MousePositionX=-1
MousePositionY=-1

[Radius]
Measure=Calc
Formula=100

[CenterX]
Measure=Calc
Formula=200

[CenterY]
Measure=Calc
Formula=200

[DragPositionX]
Measure=Calc
Formula=CenterX + Radius * cos(PI/2 - (Percent/100) * 2 * PI)

[DragPositionY]
Measure=Calc
Formula=CenterY - Radius * sin(PI/2 - (Percent/100) * 2 * PI)

[Shape]
Meter=Shape
DynamicVariables=1
;Rectangle base
Shape = Rectangle 50,50,300,300,10 | StrokeWidth 0
;Circle base
Shape2= Ellipse [CenterX],[CenterY],[Radius] | StrokeWidth 5 | Fill Color 0,0,0,1 | StrokeColor 255,100,0,150
;           {          Drag Point         }  {         Statis Point          }
Shape3= Arc [DragPositionX],[DragPositionY], ([CenterX]+1),([CenterY]-[Radius]), [Radius],[Radius], 0,1, (round([Percent]/100)),0 | StrokeWidth 7 | Stroke Color  255,100,0 | StrokeStartCap Round | StrokeEndCap Round
;A Knob for decoration
Shape4= Ellipse [DragPositionX],[DragPositionY],10 |Fill Color  255,100,0 | StrokeWidth 0

[Percent]
Measure=Calc
Formula=MouseCalc * 100
OnChangeAction=[!CommandMeasure MeasureVolume "SetVolume [Percent]"]
DynamicVariables=1

[MeasureVolume]
Measure=Plugin
Plugin=Win7AudioPlugin

[MouseCalc]
Measure=Calc
Formula=((#MousePositionY# <> -1) && (#MousePositionY# <> -1)) ? ((Atan2(CenterX-#MousePositionX#, #MousePositionY#-CenterY) + PI)/(2*PI)) : ([MeasureVolume:]/100)
DynamicVariables=1

[MeasureMouse]
Measure=Plugin
Plugin=Mouse
LeftMouseUpAction=[!SetVariable MousePositionX -1][!SetVariable MousePositionY -1]
LeftMouseDragAction=[!SetVariable MousePositionX $MouseX$][!SetVariable MousePositionY $MouseY$]

[String]
Meter=String
Text=[Percent:0]%
AntiAlias=1
DynamicVariables=1
FontFace=Segoe UI
FontSize=20
FontColor=88888888
StringAlign=CenterCenter
X=[CenterX]
Y=[CenterY]

Return to “Share Your Creations”



Who is online

Users browsing this forum: No registered users and 5 guests