tool:microsoft-visual-studio:매크로
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
tool:microsoft-visual-studio:매크로 [2013/06/20 13:53] – 새로 만듦 kieuns | tool:microsoft-visual-studio:매크로 [2024/04/23 22:44] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 1: | 줄 1: | ||
+ | ====== Macro : Header Source Toggle ====== | ||
+ | * 출처 : [[http:// | ||
+ | |||
+ | - Alt+F11 로 매크로 편집기 오픈 | ||
+ | - 아래 매크로를 추가 | ||
+ | - 키보드 설정에서, | ||
+ | - 키 할당 | ||
+ | - 사용하기 | ||
+ | |||
+ | ++++ 코드 보기 | | ||
+ | <code vbnet> | ||
+ | Public Sub toggleHeaderSource() | ||
+ | Dim currentDocumentPath As String = DTE.ActiveDocument.FullName | ||
+ | currentDocumentPath = currentDocumentPath.ToLower() | ||
+ | |||
+ | Dim currentDocumentPathWithoutExtension As String = currentDocumentPath.Remove(currentDocumentPath.LastIndexOf(" | ||
+ | |||
+ | Dim correspondingDocumentPath As String | ||
+ | Dim correspondingDocumentPath2 As String | ||
+ | |||
+ | If (currentDocumentPath.EndsWith(" | ||
+ | correspondingDocumentPath = currentDocumentPathWithoutExtension + " | ||
+ | correspondingDocumentPath2 = currentDocumentPathWithoutExtension + " | ||
+ | ElseIf (currentDocumentPath.EndsWith(" | ||
+ | correspondingDocumentPath = currentDocumentPathWithoutExtension + " | ||
+ | correspondingDocumentPath2 = currentDocumentPathWithoutExtension + " | ||
+ | End If | ||
+ | |||
+ | If (System.IO.File.Exists(correspondingDocumentPath) = True) Then | ||
+ | DTE.ExecuteCommand(" | ||
+ | ElseIf (System.IO.File.Exists(correspondingDocumentPath2) = True) Then | ||
+ | DTE.ExecuteCommand(" | ||
+ | End If | ||
+ | End Sub | ||
+ | |||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | ====== Visual Studio 매크로 ====== | ||
+ | |||
+ | VS2010에는 플러그인 개발이 오픈소스화 되어 좋은 것들을 쉽게 구할 수 있게 되었다. | ||
+ | |||
+ | 뭔가 불편하면, | ||
+ | |||
+ | 이 스크립트는 낡았다. 그냥 추억으로 나둠. | ||
+ | |||
+ | ++++ Old Script | | ||
+ | |||
+ | <code vb> | ||
+ | Imports System | ||
+ | Imports EnvDTE | ||
+ | Imports EnvDTE80 | ||
+ | Imports EnvDTE90 | ||
+ | Imports EnvDTE90a | ||
+ | Imports EnvDTE100 | ||
+ | Imports System.Diagnostics | ||
+ | |||
+ | Public Module MyMacroModule | ||
+ | |||
+ | Public Sub toggleHeaderSource() | ||
+ | Dim currentDocumentPath As String = DTE.ActiveDocument.FullName | ||
+ | currentDocumentPath = currentDocumentPath.ToLower() | ||
+ | |||
+ | Dim currentDocumentPathWithoutExtension As String = currentDocumentPath.Remove(currentDocumentPath.LastIndexOf(" | ||
+ | |||
+ | Dim correspondingDocumentPath As String | ||
+ | Dim correspondingDocumentPath2 As String | ||
+ | |||
+ | If (currentDocumentPath.EndsWith(" | ||
+ | correspondingDocumentPath = currentDocumentPathWithoutExtension + " | ||
+ | correspondingDocumentPath2 = currentDocumentPathWithoutExtension + " | ||
+ | ElseIf (currentDocumentPath.EndsWith(" | ||
+ | correspondingDocumentPath = currentDocumentPathWithoutExtension + " | ||
+ | correspondingDocumentPath2 = currentDocumentPathWithoutExtension + " | ||
+ | End If | ||
+ | |||
+ | If (System.IO.File.Exists(correspondingDocumentPath) = True) Then | ||
+ | DTE.ExecuteCommand(" | ||
+ | ElseIf (System.IO.File.Exists(correspondingDocumentPath2) = True) Then | ||
+ | DTE.ExecuteCommand(" | ||
+ | End If | ||
+ | End Sub | ||
+ | |||
+ | Sub InsertTMacro() | ||
+ | Dim selection As EnvDTE.TextSelection | ||
+ | Dim startPoint As EnvDTE.EditPoint | ||
+ | Dim endPoint As TextPoint | ||
+ | Dim commentStart As String | ||
+ | |||
+ | selection = DTE.ActiveDocument.Selection() | ||
+ | startPoint = selection.TopPoint.CreateEditPoint() | ||
+ | endPoint = selection.BottomPoint.CreateEditPoint() | ||
+ | |||
+ | DTE.UndoContext.Open(" | ||
+ | Try | ||
+ | startPoint.Insert(" | ||
+ | endPoint.Insert(" | ||
+ | Finally | ||
+ | DTE.UndoContext.Close() | ||
+ | End Try | ||
+ | End Sub | ||
+ | |||
+ | End Module | ||
+ | </ | ||
+ | |||
+ | ++++ |