Jump to content

beep sound - how do I generate in AutoIt3


Recommended Posts

When certain slow activities are complete in my program, I want to send an audible cue to the user to respond. The help says ASCII 7 is "Bell, rings the bell... (Plays Windows' default beep)"; but:

Send("{ASC 7}")

doesn't work. Thanks

Link to comment
Share on other sites

Soundplay launches the media player - this is a little heavy for a simple beep. I thought a little more about this and came up with something that works:

-----------------

MsgBox(0,"Before the Beep","")

beep()

MsgBox(0,"After the Beep","")

Exit

;

Func beep()

If Not FileExists("C:\BEEP.bat") Then

$str = "prompt "

FileWriteLine("C:\BEEP.bat", $str)

EndIf

RunWait(@ComSpec & " /c C:\BEEP.bat", "", @SW_HIDE)

EndFunc

-----------------

Note: in $str = is ctrl-G character

Thanks to 'scriptkitty' for earlier posting on using RunWait without flashing.

Is there any way to make this shorter - esp to eliminate the need for BAT file?

IAN

Link to comment
Share on other sites

Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)

Hope that works for you

Very neat, Sluggie :) .. at last my dumb pc has found its voice!

:huh2: Perhaps this can find its way into the CHM as an example of .. I dunno, @SW_HIDE? Hmmm .. or even as part of the rumoured tutorial :D

Link to comment
Share on other sites

ok have not tried this but, here are the associated players that can play a wav from with in windows...

wmplayer.exe
mplayer2.exe
amovie.ocx
sndrec32.exe
mplay32.exe
mplayer.exe

from what i have read almost if not all support /play /close switches afterwards followed by the wav file path and name of file.... the only one that is different is the amovie.ocx and it command are

rundll amovie.ocx,RunDll /play /close

i believe... if it doesn't run with rundll, try rundll32. also all the above is not included in all versions of windows. you will have to experiment... i cannot find amovie.ocx, and mplayer.exe in windws 2000. Oh i have read somewhere that mplay32.exe is limited in path length, so let it be known... i hope this all helps...

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