Jump to content

Recommended Posts

Posted

Hey there

I'm trying to harness the beep function of the PC to my script conditional activation. I mean that when a certain process in the computer stops (lets say when a USB device is formatted), a beep is played and only then I want to activate my script.

Any ideas how to do it?

Thanks!

Posted

you joined party kind of late... pc's don't use beeping for that purpose for the last 20 years or so. it's WAV files now.

start here:

'?do=embed' frameborder='0' data-embedContent>>

alternatively, you can formulate a way to detect the condition that initiated the sound, instead of the sound itself. that's where i'd go.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted (edited)

I generated the following code:

************************************************************

#include <Sound.au3>

Local $File_path = "C:WINDOWSMediaWindows XP Exclamation.wav"

Local $aSound = _SoundOpen($File_path)

While StringCompare(_SoundStatus($aSound), "playing") <>0

       Sleep(200)

       _SoundPlay($File_path)

       Consolewrite("Sound: " & _SoundStatus($aSound) & @CRLF)

WEnd

MsgBox(0,"","Playing")

_SoundClose($aSound)

 

************************************************************

But I cannot get out of the loop. Can you tell me what is wrong here?

*Its not my final code. It's just something to test the ability to detect when the computer is using wav files.

Edited by shahino007
  • 1 month later...
Posted

by the help file, _SoundPlay() requires the ID from _SoundOpen() as a parameter, not the file name.

also put some error checking in your script (see the _SoundOpen() example in the help file) - it will help you troubleshoot.

and of course, when you post code to the forum, use the code tags (the "A" button in the toolbar, tooltip "Code").

Signature - my forum contributions:

  Reveal hidden contents

 

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
×
×
  • Create New...