WannaLearn Posted January 16, 2011 Posted January 16, 2011 (edited) Hi, all.English is not my first language, so please be nice and tell me if I make mistakes.I want to mute the master volume when Hotkey1 is pressed and unmute it when Hotkey2 is pressed.I used the Send('{VOLUME_MUTE}') to mute and unmute.However, when I press the Hotkey1 twice, it unmute the master volume.I wanted to check the mute status and determine whether to send the command or not.Here is my scriptexpandcollapse popupHotkeyset('+{F2}','Mute') Hotkeyset('^{F2}','Unmute') Func Mute() If _isMute(1000) = 0 Then Send('{VOLUME_MUTE}') Elseif _isMute(1000) = 1 Then MsgBox(0,'Mute','Already Muted',3) Else ConsoleWrite('Error occured when trying to mute'&@crlf) EndIf EndFunc Func Unmute() If _isMute(1000) = 1 Then Send('{VOLUME_MUTE}') Elseif _isMute(1000) = 0 Then MsgBox(0,'Unmute','Already Unmuted',3) Else ConsoleWrite('Error occured when trying to unmute'&@crlf) EndIf EndFunc while 1 WEnd ;~ $re = _isMute(1000) ;~ If @error Then ConsoleWrite(@error & @CRLF) ;~ ConsoleWrite($re & @CRLF) ;=============================================================================== ; ; Function Name: _isMute ; Description:: Check for mute sound ; Parameter(s): ControlID ; Voulme = 1000 ; Wave = 2000 ; SW-Synthesizer = 3000 ; CD-Player = 4000 ; Mikrofon = 5000 ; Line-In = 6000 ; Requirement(s): --- ; Return Value(s): 0 = not muted, 1 = muted, -1 = timeout, -2 = ControlID not found ; Author(s): Thorsten Meger (Xenobiologist) ; ;=============================================================================== Func _isMute($opt = 1000) Local $retVal = 0, $ex = False If Not WinExists('[CLASS:Volume Control]') Then If @OSVersion = 'WIN_XP' Then Run('sndvol32', '', @SW_HIDE) Else Run('sndvol', '', @SW_HIDE) EndIf $ex = True EndIf If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1 $retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked') If @error Then Return -2 If $ex = True Then WinClose('[CLASS:Volume Control]') Return $retVal EndFunc ;==>_isMuteI have googled about it and found out that sndvol was rebuilt from the ground since Vista and that's why _isMute() is not working any more.I also found a guy said taht he was able to check the mute status by using winmm.dll and mixergetControlDetails function at here.However, I have no clue how to or what to do with it...Any help? Edited January 18, 2011 by WannaLearn
AdmiralAlkex Posted January 16, 2011 Posted January 16, 2011 Try this plugin= .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
Ascend4nt Posted January 16, 2011 Posted January 16, 2011 (edited) Also look into trancexx's - there she defines the same IAudioEndpointVolume interface that the above plugin uses, but in this case it works in both 64-bit and 32-bit modes and doesn't require extra redistributables.The problem is it would need to be extracted from the player and put into a UDF of its own, which would require a little effort.*edit: links Edited January 16, 2011 by Ascend4nt My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
WannaLearn Posted January 17, 2011 Author Posted January 17, 2011 Thank you so much for replies. Both are really long scripts... I'm trying to figure it out which part should I use. Please wish me a good luck
WannaLearn Posted January 18, 2011 Author Posted January 18, 2011 (edited) I don't really understand the mechanism how this works... Somehow I thought I got this working but... it wasn't I should try even harder... Edited January 18, 2011 by WannaLearn
WannaLearn Posted January 21, 2011 Author Posted January 21, 2011 I don't really understand the mechanism how this works... Somehow I thought I got this working but... it wasn't I should try even harder... Finally, It's working!!! Thank you for your kind reply. All I had to add was _AutoItObject_StartUp() at the beginning. I used entire _AudioVolObject function ^^ And here I post my result, a nBossKey!! You can set hotkeys for hiding/show windows. You can also set almost any activated window to fullscreen mode. Because of your help, I could be able to add a must function to it. Thank you again and I post my result here. nBossKey.exe
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