Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run macro until the end of the file in Visual Studio

Is there some AddIn or extension for Visual Studio 2008 that will allow me to run Macro until the end of the file? I really hate holding CTRL+SHIFT+P and waiting until end of the file is reached.

like image 629
nikib3ro Avatar asked Mar 21 '12 21:03

nikib3ro


1 Answers

You could record a macro and then open the Macro IDE (Alt + F11) and place the prerecorded macro in a loop like this:

Sub TemporaryMacro()
    selection = DTE.ActiveDocument.Selection()
    anchorPoint = selection.AnchorPoint.CreateEditPoint
    selection.EndOfDocument(True)
    endPoint = selection.BottomPoint.CreateEditPoint()
    selection.MoveToPoint(anchorPoint)

    Do While True
        isEOF = DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint().Line = endPoint.Line
        If (isEOF) Then
            Exit Do
        End If

        ' Prerecorded macro
        DTE.ActiveDocument.Selection.Text = " "
        DTE.ActiveDocument.Selection.LineDown()
        DTE.ActiveDocument.Selection.CharLeft()
        ' End of prerecorder macro

    Loop
End Sub
like image 161
Cristian Avatar answered Nov 15 '22 08:11

Cristian