Jump to content

sound play when left mouse click


Recommended Posts

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

When the words fail... music speaks.

Link to comment
Share on other sites

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 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

Link to comment
Share on other sites

@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

When the words fail... music speaks.

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...