Sign in to follow this  
Followers 0
shahino007

How to use the computer beep to initiate/ stop script

7 posts in this topic

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!

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

OK

The alternative way sounds fine

But how do I detect whether the PC is accessing a specific file?

Share this post


Link to post
Share on other sites

Is there any way to detect whether the computer is trying to access the beep file and use it for my use?

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

Anyone...?

Share this post


Link to post
Share on other sites

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

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

  • Similar Content

    • Wicked_Caty
      By Wicked_Caty
      I'm not really sure, if that belongs here. However, I don't need any real help, so I put it here.
      What's the difference between _WinAPI_beep($frequency, $duration) and Beep($frequency, $duration)?
      It does the same. Beeping. Is there any difference at all, apart from the name?
      Thanks xD
    • wakillon
      By wakillon
      BeepSongEditor v1.0.2.4 Create easily Beep Songs and Mp3 Ringtones

      After >Beep Song Creator by Paulie, mine is more intended to hobbyists musicians ( based on a TT22 idea )





      Now you can easily create Beep Songs and Mp3 Ringtones without being musician !
      Source and Executable are available in the Download Section

      See Tray menu for options and help.

      If somes includes are missing : Bass Includes.rar
      Somes examples of ini files : Ini files.rar

      Thanks to Brett Francis, Prog@ndy and Eukalyptus for Bass Udf and trancexx for >DSBeep.au3
      As usual several files are downloaded at first execution.


      Beep Party is back !!! Hope you like it !
    • wakillon
      By wakillon
      Create easily Beep Songs and Mp3 Ringtones
       
    • Ascend4nt
      By Ascend4nt
      I/O Port Functions UDF
      Windows 7 and x64-compatible!

      This is a simple I/O (Input/Output) UDF for interacting with ports. The ability to write to ports was stripped from Windows with Vista+. While many do not miss this ability, there are some uses still in existence:
      Re-enable the internal PC Speaker - the good ol' "Beep" function can be restored using basic I/O PS/2 Keyboard Functions - Turn it off/on, mess with LED's, inject keys into the keyboard output stream - even thwart UAC prompts! =O Also work with Parallel, Serial (COM), PS/2 mouse, and miscellaneous ports that devices interface through using I/O operations For some good lists of ports and programming, see:
      PORTS.LST Chapters from 'The Art of Assembly Language':
      20: The PC Keyboards - Part One and Part Two 21: The PC Parallel Ports - Part One, Part Two, and Part Three 22: The PC Serial Ports - Part One and Part Two 23: The PC Video Display 24: The PC Game Adapter - Part One, Part Two, Part Three and Part Four On the PS/2 Keyboard and PS/2 Mouse, some more links:
      8042 Keyboard Controller 8042 Keyboard Commands & Responses Keyboard Controller Commands, Keyboard Commands and Keyboard Scancodes The PS/2 Mouse The I/O DLL's, which will install the I/O drivers (they are embedded as a resource in the DLL), come from Phillip Gibbons. His webpage, where more information, and extra downloads are, is available here: InpOut32 and InpOutx64. Note: everything you need is already included in my UDF.

      IOInstallx86 and IOInstallx64 are included to help with the install. Run these once to install the DLL's and drivers. (Administrator rights are required!)

      In addition to the base _IOFunctions UDF, I've included _IOBeep, which is based on trancexx's _Beep function, and _IOKeyboardFunctions [PS/2 only*]. There are now three examples of the UDF usage included: IOBeepExample, IOCMOSReadExample (based on trancexx's CMOS code), and IOKeyboardExamples. If anyone else has more code suggestions, feel free to add to the thread.
      *Update: Some BIOS's allow Legacy USB Port 64/60 Emulation, which may allow the _IOKeyboardFunctions to work for USB (non-PS/2) Keyboards, though this is untested thus far.

      While I bundle the binaries with my code, remember they are not my own. However, they are released as freeware. To ensure proper credit goes where it belongs, I've included the Readme files from the download (linked above), as well as a link to the original page.

      Ascend4nt's AutoIT Code License agreement
      Screw silly licenses.  Just make sure you remember the people you get free stuff from!
       
      IOFunctions.zip
      UPDATES:
      07/11/2013:
      - Updated to use (and install) v1.5.0.0 of InpOut32 & InpOutx64
      - Version check & compare before install
      - Fixed links
      - Tiny bug fixes
      InpOut32 and InpOutx64 ChangeLog:
      v1.5.0.0 New Build (20-Jan-2011):
      - Added _stdcall to DlPortReadPortUshort, DlPortWritePortUshort, DlPortReadPortUlong, DlPortWritePortUlong to maintain compatibility with old DLPortIO driver.
      v1.4.0.0 New Build (13-Jan-2011):
      - Removed references to WinRing0 which was discontinued.
      - Fixed uninitialized buffers & return from Inp32 > byte value!
      v1.3.0.0 New Build (15-Aug-2010):
      - Removed bool's from header (replaced with BOOL). This is to maintain compatibility with other DLL’s (DLPortIO etc.).
       
      10/22/2010:
      Added _IOKeyboardFunctions UDF Added IOKeyboardExamples and IOCMOSReadExample (based on trancexx's CMOS code)