It is currently April 28th, 2024, 6:26 am

NowPlaying + Mute

Get help with creating, editing & fixing problems with skins
User avatar
UberSlackr
Posts: 34
Joined: January 21st, 2012, 12:32 am

NowPlaying + Mute

Post by UberSlackr »

Is it possible to Mute/Unmute via the NowPlaying plugin? If so, how?

I've searched the forum, and can only locate instructions to mute/unmute via Win7AudioPlugin. But that mutes system wide volume, and not just the media player.

And the NowPlaying document page, does not mention Mute ability

Trying to mute volume on "LeftMouseUpAction" then on second click, resume volume at prior state before mute.

Right now, I only have a work around, of Mute = SetVolume -100 / Unmute = SetVolume +100

Thank you for any help given..
Last edited by UberSlackr on August 7th, 2012, 6:01 am, edited 1 time in total.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: NowPlaying + Mute

Post by Mordasius »

You could use the WindowMessagePlugin to toggle the mute of the Windows Media Player on and off. I'm not sure what other media players it works with.

Code: Select all

[MeasureWindowsMedia]
Measure=Plugin
Plugin=WindowMessagePlugin.dll
WindowClass=WMPlayerApp

[MeterToggleMute]
Meter=IMAGE
ImageName=sound.png
LeftMouseUpAction=[!CommandMeasure  "MeasureWindowsMedia SendMessage 273 18817 0"] 
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: NowPlaying + Mute

Post by Kaelri »

You could also use a variable to swap with the current volume:

Code: Select all

[Variables]
LastVolume=0

[MeterToggleMute]
LeftMouseUpAction=[!SetVariable LastVolume "[mVolume]"][!CommandMeasure mPlayer "SetVolume #LastVolume#"][!Update]
DynamicVariables=1
(Given mPlayer and mVolume as your measure names.)
User avatar
UberSlackr
Posts: 34
Joined: January 21st, 2012, 12:32 am

Re: NowPlaying + Mute

Post by UberSlackr »

Kaelri wrote:You could also use a variable to swap with the current volume:

Code: Select all

[Variables]
LastVolume=0

[MeterToggleMute]
LeftMouseUpAction=[!SetVariable LastVolume "[mVolume]"][!CommandMeasure mPlayer "SetVolume #LastVolume#"][!Update]
DynamicVariables=1
(Given mPlayer and mVolume as your measure names.)

Many Many Thanks Kaelri.. That worked out perfectly.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: NowPlaying + Mute

Post by MerlinTheRed »

You only get problems when you change the volume to a positive value by hand after muting, then click the mute button again.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: NowPlaying + Mute

Post by Kaelri »

MerlinTheRed wrote:You only get problems when you change the volume to a positive value by hand after muting, then click the mute button again.
That's true. This would be a more resilient approach:

Code: Select all

[mLastPositiveVolume]
Measure=Calc
Formula=(mVolume > 0) ? mVolume : mLastPositiveVolume

[mNewVolume]
Measure=Calc
Formula=(mVolume > 0) ? 0 : mLastPositiveVolume

[MeterToggleMute]
LeftMouseUpAction=[!CommandMeasure mPlayer "SetVolume [mNewVolume]"][!Update]