Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I'm developing a routine to change file propertites on open files. The file property changes won't be saved if the file is read-only and the file is read-only if it exists in the Vault but is not checked out.
Re: How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
In Vba/VB6 use
File_Attr = GetAttr("C:\temp\test.ipt")
VB.NET use
File_Attr = System.IO.File.GetAttributes("C:\temp\test.ipt")
If File_Attr = 1 Or File_Attr = 33 Then
Msgbox ("the file is Read only")
End If
René J
Re: How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Rene, this is helpful. I noticed though that the Document object has a IsModifiable property, what is this used for?
Re: How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Correction to your code. File_Attr should be a number (not a String), I think all Enums are Longs. Also, your IF test expression only works if read-only is the only attribute set or if read-only and archive are the only two attributes set. My IF test expression below, returns if read-only is set, no matter what the other Attributes are set to.
Dim File_Attr As Long
If File_Attr And 1 Then
MsgBox("the file is Read only")
Else
MsgBox("the file is NOT Read only")
End If
Re: How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi thanks
The no. 33 If I remember right, if the inventor file is used in shared project and set to reservedforwrite and read-only
René J
Re: How to determine if an open file is read-only?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
No, 33 is the combining of 1 (read-only) and 32 (archive) file Attribute Enums (long integer).
