Thanks Doug: That is what I found as well and the same potential solutions.
I have been use to having a state property for most all volatile multi-state objects in VB.net and other languages as well as most DB Management Systems. The last one I remember that didn't have this feature was Liberty Basic about 10 years ago and I used a local variable to keep track of file state then. Perhaps there was a sys32 DLL call someplace, or another dll call, that would retrieve that info but I did not run across it at the time nor seen one pop up easily googling.
Oh well, it is what it is.
Later and thanks for the reply:
Rick USA
----- Original Message ----- From: "Doug Lee" <[email protected]>
To: <[email protected]>
Sent: Saturday, April 09, 2011 11:01 AM
Subject: Re: Checking File State in VBS


I don't see a property or method in the FileSystemObject for it, but
since you're managing the file yourself, you can always keep a
variable that holds the state and updates when you open/close the
file.

But if you're looking to know if something else has the file open, you
have a trickier situation on your hands I think.  WMI services may
give you a way to do that, as might running a Net command as a
subprocess.  The latter is probably too messy to be worth it though,
and off the top of my head, I don't know how to use WMI to find out if
a file is open by another process.  But the answer to that problem,
figuring out if anything has a file open, is more a question of what
the OS will let you do than what Window-Eyes or the FileSystemObject
will let you do.

On Sat, Apr 09, 2011 at 10:41:53AM -0400, RicksPlace wrote:
  Hi: I have a file I created using the File System Object. I want to
  check the File's state.

  Is it opened, Closed or something else.

  What Property or methods allow checking a file's state in VBS?

  I haven't found anything yet Googling.

  So, if you know anything about checking file state could you point me
  in the right direction?

  Thanks:

  Rick USA

--
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:[email protected]  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller

Reply via email to