Hansio Posted April 9, 2011 Share Posted April 9, 2011 I use MPC-HC to play my movies. Is it possible to create a script that sets Windows volume to 100% and back again when MPC-HC close? Something like setting the volume to 100% Start mpc-hc.exe Set the volume back Link to comment Share on other sites More sharing options...
Damein Posted April 9, 2011 Share Posted April 9, 2011 (edited) Sadly there is no way (at the moment) to detect what volume windows is at through AutoIt. As for setting the volume to 100%, you can do that by doing something like: For $i To 100 Step +1 Send("{VOLUME_UP}") Next ; Run("...Directory/Mpc.hc.exe") Edited April 9, 2011 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 9, 2011 Share Posted April 9, 2011 I use code like this to increase the windows volume to 100% Switch @OSVersion Case "WIN_VISTA", "WIN_7" Run("sndvol.exe", "", @SW_HIDE) Case "WIN_XP" Run("sndvol32.exe", "", @SW_HIDE) EndSwitch WinWaitActive("Volume Mixer") ControlSend("Volume Mixer", "", "msctls_trackbar321", "{HOME}") ; Max system volume WinClose("Volume Mixer") vicsar 1 - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
RichardL Posted April 10, 2011 Share Posted April 10, 2011 @somdcomputerguy I tried your code, because I should learn to use ControlSend. The window on my XP is "Volume Control", but anyway... Thinking about how to read volume level, Window Info for msctls_trackbar32 has ControlClick Coords: 24, 53, and these change with the volume. I don't know how to get these in code. Alternatively, use PixelGetColor and crawl up the control until you find the slider. Richard Link to comment Share on other sites More sharing options...
vicsar Posted June 1, 2016 Share Posted June 1, 2016 (edited) Hi, This might be useful to someone, this a full implementation; if you find it useful use it: #include <MsgBoxConstants.au3> MsgBox(64, "Easter", "You have entered the program", 30) ; Set volume to 100% (Windows actually does 2 steps increments for the volume) Local $i = 0 While $i <= 50 Send("{VOLUME_UP}", 0) $i = $i + 1 WEnd ; Sets the system wave volume to 100%. This controls the Wave volume, not the master volume control. Also, a value of Zero does not set mute status. SoundSetWaveVolume(100) ; Play one of the default sytem sounds SoundPlay(@WindowsDir & "\media\tada.wav", 1) MsgBox(64, "Easter", "The previous sound was played at 100%, the next one will be at 50%", 30) ; Set volume from 100% to 50% Local $i = 0 While $i <= 25 Send("{VOLUME_Down}", 0) $i = $i + 1 WEnd ; Sets the system wave volume to 100%. This controls the Wave volume, not the master volume control. Also, a value of Zero does not set mute status (Send("{VOLUME_MUTE}", 0) does that). SoundSetWaveVolume(100) ; Play one of the default sytem sounds SoundPlay(@WindowsDir & "\media\tada.wav", 1) MsgBox(64, "Egg", "You are leaving the program", 30) Edited September 24, 2018 by vicsar Added and explanation on how to set mute status. Minor grammar change. Yane 1 --- vicsarhttps://about.me/vicsar Link to comment Share on other sites More sharing options...
Yane Posted April 30, 2017 Share Posted April 30, 2017 On 2016. 6. 2. at 3:21 AM, vicsar said: Hi, This might be useful to someone, this a full implementation; if you find it useful use it: #include <MsgBoxConstants.au3> MsgBox(64, "Easter", "You have entered the program", 30) ; Set volume to 100% (Windows actually does 2 steps increments for the volume) Local $i = 0 While $i <= 50 Send("{VOLUME_UP}", 0) $i = $i + 1 WEnd ; Sets the system wave volume to 100%. This controls the Wave volume, not the master volume control. Also, a value of Zero does not set mute status. SoundSetWaveVolume(100) ; Play one of the default sytem sounds SoundPlay(@WindowsDir & "\media\tada.wav",1) MsgBox(64, "Easter", "The previous sound was played at 100%, the next one will be at 50%", 30) ; Set volume from 100% to 50% Local $i = 0 While $i <= 25 Send("{VOLUME_Down}", 0) $i = $i + 1 WEnd ; Sets the system wave volume to 100%. This controls the Wave volume, not the master volume control. Also, a value of Zero does not set mute status. SoundSetWaveVolume(100) ; Play one of the default sytem sounds SoundPlay(@WindowsDir & "\media\tada.wav",1) MsgBox(64, "Egg", "You are leaving the program", 30) Thank you vicsar 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now