Lakes Posted June 22, 2006 Share Posted June 22, 2006 I`ve had a look at this expandcollapse popup;Get Wav Sound Volume ; Author gafrost #include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0 $p = DllStructCreate ("dword") If @error Then SetError(2) Return -2 EndIf $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr ($p)) If ($ret[0] == $MMSYSERR_NOERROR) Then $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData ($p, 1), 8), 4)) / 0xFFFF * 100) Else SetError(1) EndIf $Struct=0 Return $WaveVol EndFunc;==>_SoundGetWaveVolume run("sndvol32.exe") WinWait("") ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") Global Const $TBM_GETPOS = $TWM_USER Func _GUICtrlSliderGetPos($h_slider) Local $ret $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Return $ret[0] EndFunc;==>_GUICtrlSliderGetPos $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) But I don`t understand whats it doing with the sliders and it gives an error on the $TWN_USER variable not being declared? Also why does it return a value of 94 when theres no audio? (mic is muted in PLAY panel, but nothing else is) Thanks! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
cassetti Posted June 22, 2006 Share Posted June 22, 2006 First off, i'd clean up the script to make it easier to see, you have functions at the top and functions at the bottom put the commands at the top, and put the functions at the bottom - i'll post the modified version of your script so its the same as what you have currently, except that it looks better, and see what i can find from there Link to comment Share on other sites More sharing options...
cassetti Posted June 22, 2006 Share Posted June 22, 2006 Ok here is your code right now as you did it - just moved stuff around - the program is still running as you created it expandcollapse popup#include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) run("sndvol32.exe") WinWait("") ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") Global Const $TBM_GETPOS = $TWM_USER $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Func _GUICtrlSliderGetPos($h_slider) Local $ret $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Return $ret[0] EndFunc;==>_GUICtrlSliderGetPos Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0 $p = DllStructCreate ("dword") If @error Then SetError(2) Return -2 EndIf $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr ($p)) If ($ret[0] == $MMSYSERR_NOERROR) Then $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData ($p, 1), 8), 4)) / 0xFFFF * 100) Else SetError(1) EndIf $Struct=0 Return $WaveVol EndFunc;==>_SoundGetWaveVolume Ok so few things Global Const $TBM_GETPOS = $TWM_USER You are saying set $TBM_GETPOS equal to $TWM_USER - but TWM_USER is not set You must declare that first I don't have time to fix the problem (at work) but that should get you started Link to comment Share on other sites More sharing options...
Lakes Posted June 22, 2006 Author Share Posted June 22, 2006 Ok here is your code right now as you did it - just moved stuff around - the program is still running as you created it expandcollapse popup#include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) run("sndvol32.exe") WinWait("") ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") Global Const $TBM_GETPOS = $TWM_USER $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Func _GUICtrlSliderGetPos($h_slider) Local $ret $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Return $ret[0] EndFunc;==>_GUICtrlSliderGetPos Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0 $p = DllStructCreate ("dword") If @error Then SetError(2) Return -2 EndIf $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr ($p)) If ($ret[0] == $MMSYSERR_NOERROR) Then $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData ($p, 1), 8), 4)) / 0xFFFF * 100) Else SetError(1) EndIf $Struct=0 Return $WaveVol EndFunc;==>_SoundGetWaveVolume Ok so few things Global Const $TBM_GETPOS = $TWM_USER You are saying set $TBM_GETPOS equal to $TWM_USER - but TWM_USER is not set You must declare that first I don't have time to fix the problem (at work) but that should get you startedIts not my script the author is GA Frost... 2015 - Still no flying cars, instead blankets with sleeves. 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