58hoo Posted November 22, 2006 Share Posted November 22, 2006 Have looked at the Help Topics for File but found nothing. I need to determine whether a file is open or closed and take action accordingly.... Thanks Link to comment Share on other sites More sharing options...
mikehunt114 Posted November 22, 2006 Share Posted November 22, 2006 Have looked at the Help Topics for File but found nothing. I need to determine whether a file is open or closed and take action accordingly.... Thanks If you're opening the file with FileOpen, you can check the return value to see if the file is open. $file = FileOpen($name, $mode) If $file = -1 Then ;file isn't open ;do stuff Else ;file is open ;do stuff EndIf If the file is being "run" or something equivalent to that, try using WinExists or WinGetState. Hope that helps. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
58hoo Posted November 22, 2006 Author Share Posted November 22, 2006 Thanks... Specifically, I want to see if a non text file is executing (a .wav file). Am not sure how it would be identified as in execution. Link to comment Share on other sites More sharing options...
mikehunt114 Posted November 22, 2006 Share Posted November 22, 2006 How about using ProcessExists? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
58hoo Posted November 23, 2006 Author Share Posted November 23, 2006 Thanks, Mike ... As I get more into this I don't think I defined the problem very well and your answers are helping me see this. Let me try to be very specific: I want to determine if a specific .wav file is BEING executed so that a sound occurs. The file always exists, its just that sometimes it is being executed by a sound producing program such as Windows Media Player. I suppose I could see if the process, WMP, exists but I wouldn't know WHAT file it was executing. For example, if two files, Call911.wav and Chill.wav, were the files in question... I would like to take different program actions depending upon which is being executed. Link to comment Share on other sites More sharing options...
mikehunt114 Posted November 23, 2006 Share Posted November 23, 2006 Yeah, in that case, my previous advice is terrible How are the files being executed? Through your script, or externally? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
dabus Posted November 23, 2006 Share Posted November 23, 2006 http://www.autoitscript.com/forum/index.php?showtopic=9641 Link to comment Share on other sites More sharing options...
58hoo Posted November 24, 2006 Author Share Posted November 24, 2006 The link Dabus supplied is rich for both approaches and solutions for my problem. Thanks all! 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