mrgreggklein Posted November 17, 2011 Posted November 17, 2011 i searched but could not find help on; i would like for the computer to play a sound file every time I left click or every time I hold left mouse button down. and drag can anyone be any help. thanks!
Andreik Posted November 17, 2011 Posted November 17, 2011 Try this: #include <Misc.au3> #include <Sound.au3> HotKeySet("{ESC}","Quit") ; Press ESC to quit While True If _IsPressed('01') Then $Sound = _SoundOpen(@WindowsDir & "Mediading.wav") Do _SoundPlay($Sound,True) Sleep(10) Until Not _IsPressed('01') _SoundClose($Sound) EndIf Sleep(10) WEnd Func Quit() Exit EndFunc
kylomas Posted November 17, 2011 Posted November 17, 2011 (edited) andreik, When I run this I get return = 0 and @error = 1 for _soundopen...Google search for MCI error deals with 3rd party install problems. Have not installed anything directly related to sound. NE ideas? kylomas Edit: also tried changing sound scheme to heritage without effect. Edited November 17, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Andreik Posted November 18, 2011 Posted November 18, 2011 @error1= MCI open error, I don't know what would be the reason, I didn't install something special to run the example above. Anyway you can try this example using native AutoIt function: #include <Misc.au3> HotKeySet("{ESC}","Quit") ; Press ESC to quit While True If _IsPressed('01') Then Do SoundPlay(@WindowsDir & "Mediading.wav",True) Sleep(10) Until Not _IsPressed('01') EndIf Sleep(10) WEnd Func Quit() Exit EndFunc
mrgreggklein Posted November 21, 2011 Author Posted November 21, 2011 @error1= MCI open error, I don't know what would be the reason, I didn't install something special to run the example above. Anyway you can try this example using native AutoIt function: #include <Misc.au3> HotKeySet("{ESC}","Quit") ; Press ESC to quit While True If _IsPressed('01') Then Do SoundPlay(@WindowsDir & "Mediading.wav",True) Sleep(10) Until Not _IsPressed('01') EndIf Sleep(10) WEnd Func Quit() Exit EndFunc IT works perfect thanks
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