shahino007 Posted April 3, 2014 Share Posted April 3, 2014 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! Link to comment Share on other sites More sharing options...
orbs Posted April 3, 2014 Share Posted April 3, 2014 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: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
shahino007 Posted April 3, 2014 Author Share Posted April 3, 2014 OK The alternative way sounds fine But how do I detect whether the PC is accessing a specific file? Link to comment Share on other sites More sharing options...
shahino007 Posted April 6, 2014 Author Share Posted April 6, 2014 Is there any way to detect whether the computer is trying to access the beep file and use it for my use? Link to comment Share on other sites More sharing options...
shahino007 Posted April 7, 2014 Author Share Posted April 7, 2014 (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 April 7, 2014 by shahino007 Link to comment Share on other sites More sharing options...
shahino007 Posted May 8, 2014 Author Share Posted May 8, 2014 Anyone...? Link to comment Share on other sites More sharing options...
orbs Posted May 8, 2014 Share Posted May 8, 2014 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: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now