Jump to content
Sign in to follow this  
Dempex

Sound detecting/touching

Recommended Posts

Dempex

Is there a possible way to detect when a running program is "touching" a wav file.

Somehow to not end or start nessecary, just if its getting touched/played of the program of the program.

Tryed to work on it but havent got it :):D:D to work .

Would yell loud if someone could help me :"> :">

Share this post


Link to post
Share on other sites
Valuater

Is there a possible way to detect when a running program is "touching" a wav file.

Somehow to not end or start nessecary, just if its getting touched/played of the program of the program.

Tryed to work on it but havent got it :)  :D  :D  to work .

Would yell loud if someone could help me  :">  :">

<{POST_SNAPBACK}>

i will try to help with my "simple wisdom" (not much there)

here are some thoughts

1.

depending on how many players you think might be "touching" the file

you can try to see if a player is playing a file with this

WinExists

--------------------------------------------------------------------------------

Checks to see if a specified window exists.

WinExists ( "title" [, "text"] )

2.

if i'm not mistaken, when a file is active (being touched) you cannot open/copy it

thus as a hidden way, you could try

FileCopy

--------------------------------------------------------------------------------

Copies one or more files.

FileCopy ( "source", "dest" [, flag] )

Parameters

source The source path of the file(s) to copy. Wildcards are supported.

dest The destination path of the copied file(s).

flag [optional] this flag determines whether to overwrite files if they already exist:

0 = (default) do not overwrite existing files

1 = overwrite existing files

Return Value

Success: Returns 1.

Failure: Returns 0.

then you could work with the error code if it is being "touched"

There are lots of ways to check.... you just have to think a little more for ideas

good luck


NEWHeader1.png

Share this post


Link to post
Share on other sites
jdickens

Valuator: Neither of those ways are sure, but I don't know the "real" way to do it. In 1) the filename might not necessarily be in the window at all; 2) Some programs permit other programs to access a wav simultaneously. There is prob. a way to determine the current rights of the file as part of the Windows OS. DirectX has its own way of claiming rights to a wav, but I think the OS keeps track of the accesses at the highest level.

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites
jdickens

Dempex:

Is there something you want to do with the wav file besides just knowing if it is being accessed? You can use AutoIt FileOpen and if you get an error, depending on what flags you use, it will let you know if you can get access to it or not? Or are you trying to tell when it is done playing or what?

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites
sylvanie

Hello,

I'm not sure that it is what you are waiting for....

I understand that you want to know what process are accessing to wav file ?

In this case use this program :

http://www.sysinternals.com/files/handle.zip

in your case the syntaxe is :

handle .wav

it'll return all process (name + pid) which are using all .wav at the moment (redirect in > toto.txt to store the output)

I hope it'll help you


Share this post


Link to post
Share on other sites
Dempex

Many many thx, ill try it, have some ideas now what to try, ill let you guys know the best way :):D after i started use autoit i just love it, "and also the forum",

Its gold worth :D:huh:

Thanks for the help m8´s :(

Share this post


Link to post
Share on other sites
Dempex

Hi Larry

It WORKS and it works great, have just 1 single question, what excatly returns.

IF $a = 0xFFFFFFFF Then

MsgBox(4096,"",$a)

EndIf

IF $a = "FFFFFFFF" Then

MsgBox(4096,"",$a,1)

EndIf

I tryed both versions, but i dont get the message box, but if i dont have the if endif

Then it works and comes up with the 8 F when busy, and not when not busy :D

Hope you can help with it, im a little "new" into autoit, before only programming in java

:):D

Share this post


Link to post
Share on other sites
Dempex

Im on the work :):D

Share this post


Link to post
Share on other sites
Dempex

The string forcing succeded, many thx Larry.

Found a little problem, thats when autoit has opended it for test, and then the program wants is, then it gives an error :) But ill see if i can fix it somehow, but if you have good ideas i would really appreciate it, you are a lot better in programming than poor mee i can see. But many thx, im on the right trail :D:D

Share this post


Link to post
Share on other sites
Dempex

Hi Larry

I tryed it, and now they can run both on same time without problems, now the only thing is that it always gives 0000000C out.

When the another application is playing the wav file, also when it is not :)

But im starting somehow to see the ide in it, just never has been that deep in autoit before, ill work further on in, but if you have good ideas/thoughts, please let me know, im also learning a lot :D:D Thanks for everything

Share this post


Link to post
Share on other sites
Dempex

Interesting, it seems like it works it WORKS, ill let in run this evening and make a test but until now Great :):D:D

It gave me more interst. Your respons was really fast and good, im thanking of it, and be sure ill rate autoit very good.

Tryed it for fun for several weeks ago, more on open closing and pixelsearch and those funny great thinks, but the more deeper you come into it, the better i like autoit, and it gave me really good inspiration to go that deep down in it.

After my "little" project i already know some more interesting "projects".

But many many thanks for the help, i can see you come from usa, next time you visite little denmark in europe ill for sure buy you a beer :huh::(

Thanks for all

Share this post


Link to post
Share on other sites
Dempex

Im a little confused, but until now everything works, just found out of another problem.

Testing it with a normall wav player then it works, but with the originall program :( .

So i tryed many diffrent things, buut nop it didnt workd, finall test, let winamp play the little wav file repeated and then the originall program also,

No error :huh::(

So they can somehow share it. how to test on it then :D:( .

That ruined my plans a little, i dont think the program puts it into memory, tryed to rename the wav folder after the program had started running, and then an error came, it could not find the folder as the wav file was needed.

But somehow it must be possible to test on the amount of programs that are sharing a file, any help would be really great, ill try to look into the code before with the shared files :):D I will really get a better programmer when finish with that project here, didnt thought it was so difficult in the start :(:(

Share this post


Link to post
Share on other sites
Champak

I need this function as well, but this guy looks like he's talking to himself about solutions that don't exist...I guess he's responding to PMs....but that's no help since he isn't actually showing what is happening. Can someone chime in and show how to detect if an audio file is being accessed by another app. please? I've searched and can't find a solution.

Share this post


Link to post
Share on other sites
diggio

Hi all, I'm a newbie and my english is not the best :)

I didn't understand if is possible to detect a sound in a program and send a mouse click, or if is possible to compare a registered sound with the sound of the program.

thanks

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  

×