Sign in to follow this  
Followers 0
swin4ort

beep sound - how do I generate in AutoIt3

6 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Wow, it actually beeps the pc speaker... It is maybe better find a way to select the .wav?

Share this post


Link to post
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

Share this post


Link to post
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...


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
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
Sign in to follow this  
Followers 0