jaberwacky Posted June 21, 2014 Share Posted June 21, 2014 (edited) When there are more than four programs that use the sound mixer, the Volume Mixer window does not resize automatically, so I decided to script a simple solution. So the way I use this is to use the blue speaker icon and then pin that to my taskbar. Also, clicking the icon while the script is running will also close the window without having to reach for the x. Edit: Forgot to mention that I've only ever used this on Windows 7 Pro x64. Update: 6/22/2014 -- Updated with AdmiralAlkex's suggestion. Plus a minor code improvement. Enjoy! expandcollapse popup#include <StringConstants.au3> #include <Misc.au3> Global Const $title = "Volume Mixer" Switch _Singleton(@ScriptName, 1) Case 0 WinClose($title) Exit EndSwitch Opt("WinDetectHiddenText", True) _main() Func _main() Local Const $volume_mixer_pid = Run("SndVol.exe") Switch $volume_mixer_pid <> -1 Case True WinWaitActive($title) Local Const $default_width = WinGetPos($title)[2] Local Const $control_threshold = 3 Local $control_count = 0 While ProcessExists($volume_mixer_pid) Switch _get_text($control_count) Case True $control_count += 1 Case False Switch $control_count >= $control_threshold Case True _resize_window($default_width, $control_count, $control_threshold) If @error Then Return SetError(1, 0, False) $control_count = 0 EndSwitch EndSwitch Sleep(100) WEnd EndSwitch EndFunc Func _resize_window(Const $default_width, Const $control_count, Const $control_threshold) Local Const $x = WinGetPos($title) If @error Then Return SetError(1, 0, False) Local Const $new_width = $default_width + (($control_count - $control_threshold) * 110) Switch $new_width <= (@DesktopWidth - $x[0]) Case True WinMove($title, '', Default, Default, $new_width) EndSwitch EndFunc Func _get_text(Const $control_count) Local Const $text = StringStripWS(WinGetText($title), ($STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES)) Return StringInStr($text, "Volume for", 0, ($control_count + 1)) > 0 EndFunc Edited June 23, 2014 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 22, 2014 Share Posted June 22, 2014 You should probably have it stop growing before it goes outside the screen. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jaberwacky Posted June 22, 2014 Author Share Posted June 22, 2014 Do you mean that it just randomly keeps growing? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 22, 2014 Share Posted June 22, 2014 No, not randomly. Open a dozen+ media players and see what I mean. If you stop growing at @DesktopWidth then the user can scroll to the many that doesn't fit the screen, which would be more comfortable than moving the window around to see the rest. jaberwacky 1 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jaberwacky Posted June 22, 2014 Author Share Posted June 22, 2014 Awesome. Didn't even consider this. Thanks for the suggestion! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 22, 2014 Share Posted June 22, 2014 There's some application I have (VMware Workstation?) that spazzes out and does this to me. For some reason it doesn't clean up after itself (until it's completely shut off) so there's tons of VMware volumes in the mixer but only 1 work... It's not fun finding the one that works when you only see 3 of them . I will keep this script around for those occasions .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jaberwacky Posted June 22, 2014 Author Share Posted June 22, 2014 Try the latest update please. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted June 22, 2014 Author Share Posted June 22, 2014 I actually introduced a bug, but it's fixed now. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 12, 2014 Share Posted July 12, 2014 I think there might still be a bug, or is this how you intended it to work? Good: Start the script and spam music players: properly expands until the screen if filled. Bug? Spam music players then start the script afterwards. No resize at all. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jaberwacky Posted July 12, 2014 Author Share Posted July 12, 2014 It's a bug. I will look into it. Thanks! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted July 15, 2014 Author Share Posted July 15, 2014 Sorry for being late on this, but I can't find the issue. It works for me on my machine. Could you try to look into it? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? 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