It is currently April 18th, 2024, 5:39 pm

ScrollVolume

Media controls, music players, video and animated visualizers
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

ScrollVolume

Post by jsmorley »

Simple volume control that you can scroll with the mouse wheel or click on the bar to change the system volume. The speaker icon toggles "mute".

Requires Windows 7 or better and the latest Rainmeter 3.1 beta from http://rainmeter.net.
ScrollVolume_1.1.rmskin
ScrollVolume.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
rm_lion
Posts: 93
Joined: December 27th, 2013, 4:04 pm
Location: Switzerland

Re: ScrollVolume

Post by rm_lion »

Cool. Thank you.
User avatar
rm_lion
Posts: 93
Joined: December 27th, 2013, 4:04 pm
Location: Switzerland

Re: ScrollVolume

Post by rm_lion »

Hello jsmorley,

I noticed this line in the code:

Code: Select all

Text=[MeasureWin7Audio:]%
and I wonder what the colon in [MeasureWin7Audio:] stands for.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ScrollVolume

Post by jsmorley »

rm_lion wrote:Hello jsmorley,

I noticed this line in the code:

Code: Select all

Text=[MeasureWin7Audio:]%
and I wonder what the colon in [MeasureWin7Audio:] stands for.
http://docs.rainmeter.net/manual/variables/section-variables#Colon
User avatar
rm_lion
Posts: 93
Joined: December 27th, 2013, 4:04 pm
Location: Switzerland

Re: ScrollVolume

Post by rm_lion »

Thank you for the link.
So I think in this case the colon isn't really needed because the percent tells the Measure already that the number value is needed.
Manual 3.1 Win7Audio plugin: Returns the name of the current sound device (when used in a String meter) and the percentage (0-100) of current volume level (when used in a meter which requires a percentage).
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ScrollVolume

Post by jsmorley »

[MeterVolumeText]
Meter=String
X=4R
Y=0r
FontFace=Segoe UI
FontSize=12
FontColor=200,250,185,255
StringStyle=Bold
Text=[MeasureWin7Audio:]%
AntiAlias=1
DynamicVariables=1

Nothing about that is a percentage though. So the colon is needed or the Text option will use the string value, which is the name of the device as I recall.

The Percentual option only effects values set on the meter with MeasureName, and then only if no Text option used, or if %1 etc. is used in the Text option. [SectionVariables] used in the Text option will always use the string value unless a colon is used.

Sent from my Kindle Fire HDX
User avatar
rm_lion
Posts: 93
Joined: December 27th, 2013, 4:04 pm
Location: Switzerland

Re: ScrollVolume

Post by rm_lion »

I tested it whithout colon and it works exactly the same way.
If I check the Variable on the Skins Tab in the About Window the Value is: "Speakers"
Nevertheless on the Meter in the Skin the numerical Value between 0 and 100 is perfectly displayed even without colon.
I appreciate your work. You could tell that I am a little "fan" of you. And I know that I can learn a whole lot of you. That is the reason why I investigated your code. I have never noticed or used this colon before eventhough I have made quite a lot of different Skins for myself in the last 5 month. So the first thing that I have done when I came across the colon, is that I deleted them to check what happens.
So please don't get me wrong. It isn't important at all. And I really don't want to make you upset. But somehow the colon is really not needed. But I can't tell you where the Magic happens.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ScrollVolume

Post by jsmorley »

It really, really is needed though... ;-)

I'm not sure, but I think what you are missing is that while the Text option of the [MeterVolumeText] meter is set to Text=[MeasureWin7Audio:]%, that is more or less a "place-holder" in any case. The important bit is in [MeasureWin7Audio], where anytime the volume is set to zero or higher, (not muted in other words) it will force that value with the colon on the Text option using [!SetOption MeterVolumeText Text "[*MeasureWin7Audio:*]%"]. What that does is force the literal string "[MeasureWin7Audio:]%" as the Text option. The "*" symbols in there are to "escape" the measure, so it is used just as it is as a string, and not evaluated in the bang itself. It's only evaluated in the String meter.

Removing the colon from the String meter doesn't really matter, as this IfABoveAction will instantly put the colon right back on anyway. To be honest, the Text option isn't even needed on the String meter, as the IFActions will always set it to what it should be. It's there more or less to make it obvious what that String meter is for.

If you remove the colon from that bang in the IfAboveAction, trust me, it won't work. It will say "Volume: Speakers%".

Code: Select all

[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin
IfBelowValue=0
IfBelowAction=[!SetOption MeterVolumeIcon ImageName "#@#Images\mute_white.png"][!SetOption MeterVolumeText Text "Mute"][!UpdateMeter *][!Redraw]
IfAboveValue=-1
IfAboveAction=[!SetOption MeterVolumeIcon ImageName "#@#Images\volume_white.png"][!SetOption MeterVolumeText Text "[*MeasureWin7Audio:*]%"][!UpdateMeter *][!Redraw]
There are not a huge number of times or places [MeasureName:] is needed rather than just [MeasureName]. It is only needed if a measure returns both a number value and a string value, and they are different. (or if you want to modify the number with supported section variable "number modifiers") This Win7AudioPlugin is one, where it returns the name of the device in the string value and the current volume level in the number value. FreeDiskSpace is another one, where if you set the Type option, it returns the type of device as a string (like Removable / Fixed/ CDRom) and the number of that device type as a number. So in that case to use the number as a [SectionVariable], you would need the colon [SectionVariable:].

In the vast majority of cases, the string and number values returned by a measure are the same.

Remember that you never need to worry about a colon unless you are using a measure as a [SectionVariable]. When you bind a measure to a meter with MeasureName=SomeMeasure, the correct string or number value is used based on the type of meter.

So don't worry about upsetting me by questioning what I say. I am sure I must be capable of being wrong, but we won't really know until I am wrong, which in this case I'm absolutely not...
;-)
User avatar
rm_lion
Posts: 93
Joined: December 27th, 2013, 4:04 pm
Location: Switzerland

Re: ScrollVolume

Post by rm_lion »

You are absolutely right.
I didn't realize that the value of the meter is set by the measure. :?
If I delete the colon in the measure the displayed value changes to "Speakers".

Thanks a lot for your patience.