|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
set IDE file as ReadOnlyHi,
My project include reading XML files, I would like to set ReadOnly via a Keyboard Hot Key combination on the test XML files when I open them in the IDE. Is there an IDE Command I can setup with a Hot Key combination? Thanks, Lausivcip I haven't found any VS command that can do it. You can however write
simple macro which will toggle read-only state of active document: ''' <summary> ''' Toggles the read-only flag of active open document in the IDE. ''' </summary> Sub ToggleReadonly() Dim filename As String Dim attributes As System.IO.FileAttributes filename = DTE.ActiveDocument.FullName attributes = System.IO.File.GetAttributes(filename) ' negate read-only attributes = attributes Xor IO.FileAttributes.ReadOnly System.IO.File.SetAttributes(filename, attributes) End Sub 1. Create this macro, see http://www.helixoft.com/blog/archives/6 if you don't know how. 2. Assign a keybord shortcut to it, see http://www.helixoft.com/blog/archives/8 -- Peter Macej Helixoft - http://www.helixoft.com VSdocman - Commenter and generator of class documentation for C#, VB ..NET and ASP .NET code Works Great. Thanks very much!
Lausivcid On Wed, 28 Nov 2007 09:53:10 +0100, Peter Macej <pe***@helixoft.com> wrote: Show quote >I haven't found any VS command that can do it. You can however write >simple macro which will toggle read-only state of active document: > ''' <summary> > ''' Toggles the read-only flag of active open document in the IDE. > ''' </summary> > Sub ToggleReadonly() > Dim filename As String > Dim attributes As System.IO.FileAttributes > > filename = DTE.ActiveDocument.FullName > attributes = System.IO.File.GetAttributes(filename) > ' negate read-only > attributes = attributes Xor IO.FileAttributes.ReadOnly > System.IO.File.SetAttributes(filename, attributes) > End Sub > >1. Create this macro, see http://www.helixoft.com/blog/archives/6 if you >don't know how. >2. Assign a keybord shortcut to it, see >http://www.helixoft.com/blog/archives/8 |
|||||||||||||||||||||||