eddie4 Posted August 24, 2010 Share Posted August 24, 2010 Hello am trying to detect when when an addon in World of Warcraft is done. When this addon is done it will play a sound. I have searched the forum and I got the feeling that that seems tricky. So I looked up if I could detect the sound file being opened but so far my search has ended up whit no results that I could use. I was hoping some one could point me in the right direction or post an example. http://www.autoitscript.com/autoit3/docs/functions/FileOpen.htm (Checks if the file is readable?) http://www.autoitscript.com/forum/index.php?showtopic=42511&st=0 (Only create and delete?) Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 24, 2010 Share Posted August 24, 2010 (edited) It may not be the best way, but I heard that newer versions of windows removed the internal speaker beep code (or something)So, you can use a system sound by doing something like#Include <WinAPI.au3>$path= full path to some wav file (or mp3 or whatever)$type = _WinAPI_FindExecutable($path)Run($type & " " & $path)*edit* just realized you wanted to listen for a sound, not play a sound... I believe I remember something about this in another thread, I will go look for it.*edit*Here is a link where someone detected a sound and had it do somethingMy linkHowever, _SoundStatus() may be enough if you know what sound file WoW is using. Then all you need to do is check for a change in a loop (theoretically) Edited August 24, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
eddie4 Posted August 24, 2010 Author Share Posted August 24, 2010 (edited) Reading that topic that you linked, it seems that project was using a mic to pick up if there is someone in that room and then turn on the music. This does not apply to my project as it is running in an virtual machine and it will need to pick up an specific sound. I think that my first post is kind of misleading ill change that in a sec. What am trying to do is find out if an specific .ogg file is played. Trying to pick this up via sound card might be over complicating things it might be easier to detect when this sound file is opened. Although this is my first project whit autoit so am not sure what is easier Edit It seems that am unable to change the original topic the clarify and change the title Edited August 24, 2010 by eddie4 Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 24, 2010 Share Posted August 24, 2010 You might be able to use the _SoundStatus method on that ogg file then. If I'm not mistaken you could put it in a loop such as $check=_SoundStatus(path\file.ogg) While $check = whatever the state of _soundStatus is on an unused file $check=_SoundStatus(path\file.ogg) sleep(10) wend code Theoretically, it should sleep until the status of the file changes, then exit the loop and perform your code. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 25, 2010 Share Posted August 25, 2010 Hmm.. interesting situation. You could try to see if the file is in use - check out _FileInUse. Or perhaps monitor the folder (I'm not sure if individual file monitoring is available..) - Folder Monitor. There is a '$FILE_NOTIFY_CHANGE_LAST_ACCESS' option, but I wouldn't know how to get all that to work, or if it really would work properly (seems to not register some events for me) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
eddie4 Posted August 25, 2010 Author Share Posted August 25, 2010 I took the time to try the options you have suggested whit no success so far. To try and see if handle.exe from sysinternals could be of help I have been trying to see if it could detect the usage of the sound file whit no luck so far. My fear is that WoW will loaded all addon files at starting the game so detecting it from being read from disk seems small. So I guess it back to detecting what comes out of the speakers Link to comment Share on other sites More sharing options...
kaotkbliss Posted August 25, 2010 Share Posted August 25, 2010 If you have a stand-alone mic you could point it at the speakers so when sound comes out of the speakers, it's picked up by the mic, then you know when the sound it played... I know, that's silly. I'm going to do some tests with _soundstatus and _fileinuse and see if I can come up with anything. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Ascend4nt Posted August 28, 2010 Share Posted August 28, 2010 I figured out how to monitor if a file has been accessed (NTFS file system), but this will only help once the file is closed. For different games and applications I've tested this on, it works well. Some games or processes will not close a file handle until they exit (bad coding practice), which means the file's Last-Access time won't be updated until the program exits. However, for 'well-behaved' programs this should work well. The reason we can't just monitor a Last-Access time without first altering it is due to the way NTFS works (quote below from 'How NTFS Works: Local File Systems'): The Last Access Time on disk is not always current because NTFS looks for a one-hour interval before forcing the Last Access Time updates to disk. NTFS also delays writing the Last Access Time to disk when users or programs perform read-only operations on a file or folder, such as listing the folder’s contents or reading (but not changing) a file in the folder. If the Last Access Time is kept current on disk for read operations, all read operations become write operations, which impacts NTFS performance. #include <Date.au3> Local $sFile,$sLastAccess,$sNewDate,$aTemp ;~ $sFile="G:\Games\Singularity(TM)\RvGame\Movies\ravenlogo.bik" ; doesn't seem to update until program exits ;~ $sFile="G:\Games\Prince of Persia The Forgotten Sands\Videos\Ubi_new_logo.bik" $sFile="G:\Games\Prince of Persia\Videos\Ubi_Logo.bik" ; Subtract 1 hour from File's Last-Access Time (to workaround NTFS File System's one-hour interval updates) $aTemp=FileGetTime($sFile,2,0) ; Last-Access, Return as array If @error=0 Then ConsoleWrite("Changing date.."&@CRLF) $sNewDate=_DateAdd('h',-1,$aTemp[0]&'/'&$aTemp[1]&'/'&$aTemp[2]&' '&$aTemp[3]&':'&$aTemp[4]&':'&$aTemp[5]) ; format for function If @error=0 Then $sNewDate=StringRegExpReplace($sNewDate,'[\s/:]','') ; remove formatting and put into YYYYMMDDHHMMSS form ConsoleWrite("New Time:"&$sNewDate&@CRLF) FileSetTime($sFile,$sNewDate,2) ; finally set Last-Access Time to -1 Hour EndIf EndIf ; Now grab the Last Access time and monitor for changes in it $sLastAccess=FileGetTime($sFile,2,1) ConsoleWrite("Base time:"&$sLastAccess&@CRLF) Do Sleep(10) Until $sLastAccess<>FileGetTime($sFile,2,1) ConsoleWrite("Accessed!:"&FileGetTime($sFile,2,1)&@CRLF) Beep() My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
eddie4 Posted August 29, 2010 Author Share Posted August 29, 2010 Hmm that seems very usefull ill keep my fingers crossed if they coded it correctly 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