bradley1 Posted July 25, 2006 Share Posted July 25, 2006 (edited) Forgive me if this is question is somewhat basic, but here's the deal:I have two computers that are networked together. If the first computer (named "main") has a file open and the second computer tries to open the file like so - $File = FileOpen("//main/inv.txt",2) $FileWriteLine($File,Price[5] & "," & Price[6])I get an error. I think that when the "main" computer has this file open (which will be the case sometimes and there's no way around that) I get the error:AutoIt ErrorLine 0 (File "C:\bot.txt"):$FileWriteLine($File,Price[5] & "," & Price[6])Error: Invalid File Handle usedI have searched the helpfile for a solution and haven't found a specific function to use, but basically I need a way to tell if another user has this file open. Does AutoIt Have this capability or something in the works? Or is there an easy fix that I'm just not thinking of?Any help is greatly appreciated, thanks. BTW, AutoIT rocks - I have been able to learn it fairly quickly and have done some pretty cool stuff with it.-Brad Edited July 25, 2006 by bradley1 Link to comment Share on other sites More sharing options...
MHz Posted July 25, 2006 Share Posted July 25, 2006 (edited) Look at the example of FileOpen in the Helpfile. The example shows use of error checking to help eliminate problems.$file = FileOpen("test.txt", 0); Check if file opened for reading OKIf $file = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIf Edited July 25, 2006 by MHz Link to comment Share on other sites More sharing options...
bradley1 Posted July 25, 2006 Author Share Posted July 25, 2006 Sounds like a simple fix...I was familiar with @error and such but didn't even think to use it here. Thanks a ton. -Brad 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