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   [16039 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 74 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   [4520 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]
User avatar

Re: Demonstrating the Mouse plugin

July 3rd, 2017, 8:02 pm
StArL0rd84
   [187 posts]

Figured it could also be used to resize a skin :D
Yet another use of this awesome plugin!
Click GIF to see it in action.

Looks real smooth irl

Code: Select all

[RainMeter]
 Update=1000
 AccurateText=1
 OnRefreshAction=[!SetTransparency "#SkinTrans#"][!SetVariable CurrMon [mCurrMon]][!WriteKeyValue Variables CurrMon "[mCurrMon]" "#NasaVar#"][!UpdateMeterGroup Sizable][!UpdateMeter *][!Redraw]
 MouseOverAction=[!ShowMeterGroup Nav][!ShowMeterGroup Resize][!ShowMeterGroup Title][!UpdateMeter *][!Redraw][!ZPos "#MoPos#"]
 MouseLeaveAction=[!HideMeterGroup Nav][!HideMeterGroup Resize][!HideMeterGroup Title][!UpdateMeter *][!Redraw][!ZPos "#MlPos#"]


[Variables]
 @include=#@#Variables\Variables.inc
 @include1=#@#Variables\NasaVars.inc
 @include2=#@#Variables\ThemesVars.inc
 @include3=#@#Variables\Themes\#SelectedTheme#.inc

DragPointX=564
DragPointY=428
CurrMon=1
CurrMonHeight=1440
CurrMonWidth=3440

[TextStyle]
 Meter=String
 FontColor=#TextColor2#
 FontSize=10
 FontFace=ITC Avant Garde Pro Bk
 StringStyle=Normal
 StringAlign=Center
 ClipString=2
 AntiAlias=1
 DynamicVariables=1

[Top1]
 Meter=Image
 ImageName=#@#Images\Backgrounds\Top.png
 ImageTint=#AccentColor#
 AntiAlias=1
[Top2]
 Meter=Image
 ImageName=#@#Images\Backgrounds\Top.png
 ImageTint=#AccentColor#
 AntiAlias=1
 X=([mMouseX]-296)
 DynamicVariables=1
 Group=Sizable
[TopMiddle]
 Meter=Image
 SolidColor=#AccentColor#
 AntiAlias=1
 X=(([mMouseX]/2)-([TopMiddle:W]/2))+2
 W=([Card:W])-16
 H=4
 DynamicVariables=1
 Group=Sizable
[Card]
 Meter=Image
 Y=4
 W=([mMouseX]+4)
 H=([mMouseY]-4)
 SolidColor=#CardColor#
 DynamicVariables=1
 Group=Sizable
[Bottom]
 Meter=Image
 ImageName=#@#Images\Backgrounds\Top.png
 ImageTint=#AccentColor#
 ImageFlip=Vertical
 Y=[mMouseY]
 AntiAlias=1
 DynamicVariables=1
[Bottom2]
 Meter=Image
 ImageName=#@#Images\Backgrounds\Top.png
 ImageTint=#AccentColor#
 ImageFlip=Vertical
 AntiAlias=1
 X=([mMouseX]-296)
 Y=r
 DynamicVariables=1
 Group=Sizable
[BottomMiddle]
 Meter=Image
 SolidColor=#AccentColor#
 AntiAlias=1
 X=(([mMouseX]/2)-([BottomMiddle:W]/2))+2
 Y=r
 W=([Card:W])-16
 H=4
 DynamicVariables=1
 Group=Sizable


[mMouse]
 Measure=Plugin
 Plugin=Mouse
 LeftMouseDragAction=[!SetOption mMouseX Formula "clamp($MouseX$,296,#CurrMonWidth#)"][!UpdateMeasure mMouseX][!SetOption mMouseY Formula "clamp($MouseY$,46,#CurrMonHeight#)"][!UpdateMeasure mMouseY][!UpdateMeterGroup Sizable][!ShowMeterGroup Nav][!ShowMeterGroup Resize][!ShowMeterGroup Title][!UpdateMeter *][!Redraw]
 LeftMouseUpAction=[!CommandMeasure mMouse "Stop"]
 RequireDragging=1
 DynamicVariables=1
[mMouseX]
 Measure=Calc
 Formula=#DragPointX#
 DynamicVariables=1
 OnChangeAction=[!SetVariable DragPointX [mMouseX]][!WriteKeyValue Variables DragPointX "[mMouseX]" "#NasaVar#"]
[mMouseY]
 Measure=Calc
 Formula=#DragPointY#
 DynamicVariables=1
 OnChangeAction=[!SetVariable DragPointY [mMouseY]][!WriteKeyValue Variables DragPointY "[mMouseY]" "#NasaVar#"]

[mNumMon]
 Measure=Plugin
 Plugin=SysInfo
 SysInfoType=NUM_MONITORS
[mCurrMon]
 Measure=Script
 ScriptFile=#@#lua\CurrentMonitor.lua
 NumMonitors=[mNumMon]
 OnChangeAction=[!SetVariable CurrMon [mCurrMon]][!WriteKeyValue Variables CurrMon "[mCurrMon]" "#NasaVar#"]
 IfCondition=(mCurrMon=1)
 IfTrueAction=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@1#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@1#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@1#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@1#" "#NasaVar#"]
 IfCondition2=(mCurrMon=2)
 IfTrueAction2=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@2#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@2#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@2#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@2#" "#NasaVar#"]
 IfCondition3=(mCurrMon=3)
 IfTrueAction3=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@3#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@3#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@3#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@3#" "#NasaVar#"]
 IfCondition4=(mCurrMon=4)
 IfTrueAction4=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@4#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@4#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@4#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@4#" "#NasaVar#"]
 IfCondition5=(mCurrMon=5)
 IfTrueAction5=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@5#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@5#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@5#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@5#" "#NasaVar#"]
 IfCondition6=(mCurrMon=6)
 IfTrueAction6=[!SetVariable CurrMonWidth #SCREENAREAWIDTH@6#][!WriteKeyValue Variables CurrMonWidth "#SCREENAREAWIDTH@6#" "#NasaVar#"][!SetVariable CurrMonHeight #SCREENAREAHEIGHT@6#][!WriteKeyValue Variables CurrMonHeight "#SCREENAREAHEIGHT@6#" "#NasaVar#"]

[mSDO]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 UpdateRate=1800
 Url=#SDOURL#
 StringIndex=1
 Download=1
[mHubbleNow]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 UpdateRate=1800
 Url=#HubbleNow#
 RegExp="(?siU)<enclosure url="(.*)" length="
 StringIndex=1
 Download=1
[mCleanRoomWebcam]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 UpdateRate=300
 Url=#CleanRoomURL#
 StringIndex=1
 Download=1
[mImageOfTheDay]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 UpdateRate=1800
 Url="#ImageOfTheDayURL#"
 RegExp="(?siU)(?(?=.*<IMG SRC).*<IMG SRC="(.*)").*<center>.*<b>(.*)</b>"
 StringIndex=1
 Download=1
[mImageOfTheDayTitle]
 Measure=Plugin
 Plugin=Plugins\WebParser.dll
 UpdateRate=1800
 Url="#ImageOfTheDayTitleUrl#"
 RegExp="(?siU)<IMG SRC=\"(.*)\".*<b>(.*)<"
 StringIndex=2

[Image]
 Meter=Image
 MeasureName=#CurrentImageMeasure#
 X=8
 Y=8
 W=([mMouseX]-12)
 H=([mMouseY]-12)
 PreserveAspectRatio=2
 LeftMouseUpAction=["[mLink]"]
 DynamicVariables=1
 Group=Sizable

[CornerUL]
 Meter=Image
 ImageName=#@#Images\Backgrounds\InnerCornerUL.png
 ImageTint=#CardColor#
 X=8
 Y=8
[CornerLL]
 Meter=Image
 ImageName=#@#Images\Backgrounds\InnerCornerUL.png
 ImageTint=#CardColor#
 ImageFlip=Vertical
 X=8
 Y=(4+[Image:H])
 DynamicVariables=1
 Group=Sizable
[CornerUR]
 Meter=Image
 ImageName=#@#Images\Backgrounds\InnerCornerUR.png
 ImageTint=#CardColor#
 X=(4+[Image:W])
 Y=8
 DynamicVariables=1
 Group=Sizable
[CornerLR]
 Meter=Image
 ImageName=#@#Images\Backgrounds\InnerCornerUR.png
 ImageTint=#CardColor#
 ImageFlip=Vertical
 X=(4+[Image:W])
 Y=(4+[Image:H])
 DynamicVariables=1
 Group=Sizable

[ResizeBG]
 Meter=Image
 ImageName=#@#Images\Arrows\ResizeBG.png
 ImageTint=#IconsColor1#
 LeftMouseDownAction=[!CommandMeasure mMouse "Start"]
 X=([mMouseX]-20)
 Y=([mMouseY]-20)
 DynamicVariables=1
 Group=Sizable | Resize
 MouseActionCursorName=DiagonalResize.cur
 Hidden=1
[ResizeArrows]
 Meter=Image
 ImageName=#@#Images\Arrows\ResizeArrows.png
 ImageTint=#IconsColor2#
 X=r
 Y=r
 DynamicVariables=1
 Group=Sizable | Resize
 Hidden=1

[TitleBg1]
 Meter=Image
 SolidColor=#CardColor#
 X=8
 Y=8
 W=[Image:W]
 H=22
 DynamicVariables=1
 Group=Sizable | Title
 Hidden=1
[TitleBg2]
 Meter=Image
 ImageName=#@#Images\TextBars\TextBar17.png
 ImageTint=#TextBarsColor#
 X=8
 Y=8
 AntiAlias=1
 DynamicVariables=1
 Group=Sizable | Title
 Hidden=1
[TitleBg3]
 Meter=Image
 ImageName=#@#Images\TextBars\TextBar17.png
 ImageTint=#TextBarsColor#
 X=([Image:W]-47)+8
 Y=r
 AntiAlias=1
 DynamicVariables=1
 Group=Sizable | Title
 Hidden=1
 [TitleBg4]
 Meter=Image
 SolidColor=#TextBarsColor#
 AntiAlias=1
 X=(([mMouseX]/2)-([BottomMiddle:W]/2))+16
 Y=r
 W=([Card:W])-48
 H=18
 DynamicVariables=1
 Group=Sizable | Title
 Hidden=1
[Title]
 Meter=String
 MeterStyle=TextStyle
 MeasureName=mImageOfTheDayTitle
 X=(16+[Image:W])/2
 Y=1r
 W=([Card:W])-48
 H=18
 ClipString=1
 DynamicVariables=1
 Group=Sizable | Title
 Hidden=1

[InfoCalc]
 Measure=Calc
 Formula=([mMouseY]+4)
 DynamicVariables=1
 Group=Sizable
[Info]
 Meter=String
 Text=Skin Height: [InfoCalc]#CRLF#Current Monitor: #CurrMon##CRLF#Current Monitor Height: #CurrMonHeight#
 AntiAlias=1
 X=-280
 Y=-200
 FontFace=Courier New
 FontColor=255,255,255
 SolidColor=0,0,0
 StringAlign=Right
 DynamicVariables=1
 Group=Sizable

[Settings]
 Meter=Image
 ImageName=#@#Images\Dot6.png
 ImageTint=#IconsColor1#
 LeftMouseUpAction=[!WriteKeyValue Variables SettingsConfiguration "NASA" #Var#"][!ActivateConfig "#i0#" "Settings.ini"][!Refresh #i0#]
 MouseOverAction=[!SetOption Settings ImageTint #IconsColor2#][!UpdateMeter *][!Redraw]
 MouseLeaveAction=[!SetOption Settings ImageTint #IconsColor1#][!UpdateMeter *][!Redraw]
 MouseActionCursor=1
 DynamicVariables=1
 AntiAlias=1
 X=(4+[Image:W])
 Y=-2
 W=14
 Hidden=1
 Group=Nav

Return to “Share Your Creations”



Who is online

Users browsing this forum: No registered users and 5 guests