It is currently April 20th, 2024, 10:13 am

Set System Volume on Button Press

Get help with creating, editing & fixing problems with skins
User avatar
Kitsune269
Posts: 2
Joined: July 22nd, 2021, 11:30 pm
Location: California

Set System Volume on Button Press

Post by Kitsune269 »

Hello everyone, long time lurk, first time post.

Just as the title says, I simply want to set the system main volume when I click a button. I will explain why/how I am doing this.

I will include the code I have so far. What I have is a little Train shaped button (for this file). When you click it, it plays train sounds that help the people in care here to sleep. The button press launches windows media player and the sounds begin. We use this for several sounds/videos to allow the clients to see what they are choosing. To keep things simple, the media players are all locked at 100% and everything is changed using system main volume. The problem is that some of the videos/audio is very quiet and this results in some people turning the system volume VERY high and forgetting. Then someone else will click on a loud audio/video file and its just not a good combination with the elderly. Needless to say this NEEDS TO STAY SIMPLE. No meters, no fancy displays, no imaging, no showing anything about status. Just set the system volume to a set amount when each one is clicked. Nothing more please. These seniors CANNOT just be taught other ways, or they would not be in our care. I just need to know how to tell each "button" what system volume to change to when its clicked to prevent blasting audio or silent audio. The clients in care ONLY have access to the screen with clickable buttons (preview images). They cannot access anything else on the system (except the audio and that will be disabled when I learn this solution), so there is no need to recall/revert the volume after play has ended. It just needs to be set when the next file is clicked. Thank you for any help.

Everything in the code works except it has NO effect on the system volume. System is using Windows 10. I have learned more than I can list from this forum, but interestingly I just cannot find this (I'm sure its simple) solution. Trying to understand the tutorials is something I have been doing, but as this problem occurs all the time, I kind of need help faster than I can learn this. Elderly clients + sudden loud noises = things nobody at work wants to have happen, if you know what I mean.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=Train Sounds
Author=Kitsune269
Information=Start Train sleeping sounds!
License=To be Awesome!
Version=1.0

[MeasureWin7Audio]
Measure=Plugin
Plugin=Win7AudioPlugin

[MeterPlayIcon]
Meter=Button
X=0
Y=0
ButtonImage=#@#Images\Trains\train.png
LeftMouseUpAction=["D:\Music and Pictures\Music\Ripped\Trains.mp3"]
LeftMouseUpAction=[!CommandMeasure "MeasureWin7Audio" "SetVolume 14"]
Last edited by eclectic-tech on July 23rd, 2021, 1:00 am, edited 1 time in total.
Reason: Please use the code tag </> when posting long codes.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Set System Volume on Button Press

Post by eclectic-tech »

You can have only 1 of any mouse button actions in a meter, but you can combine the bangs for the LeftMouseUpAction...

Code: Select all

...
[MeterPlayIcon]
Meter=Button
X=0
Y=0
ButtonImage=#@#Images\Trains\train.png
LeftMouseUpAction=[!CommandMeasure "MeasureWin7Audio" "SetVolume 14"]["D:\Music and Pictures\Music\Ripped\Trains.mp3"]
User avatar
Kitsune269
Posts: 2
Joined: July 22nd, 2021, 11:30 pm
Location: California

Re: Set System Volume on Button Press

Post by Kitsune269 »

I see now! I had completely misunderstood and thought that you added the full LeftMouseUpAction for EACH thing it needs to do. I did not realize they must be combined. Thank you VERY much for the fast reply and the working solution. This makes myself and no doubt the others so happy. Thank you sincerely from all of us!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5398
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Set System Volume on Button Press

Post by eclectic-tech »

Happy to help...
"Sweet Dreams to All!" :D