c# - 在 Visual Studio 中运行宏直到文件末尾

标签 c# visual-studio visual-studio-2008 macros

Visual Studio 2008 是否有一些加载项或扩展允许我运行宏直到文件结束?我真的很讨厌按住 CTRL+SHIFT+P 并等到文件末尾。

最佳答案

您可以录制一个宏,然后打开宏 IDE (Alt + F11) 并将预先录制的宏放入一个循环中,如下所示:

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

关于c# - 在 Visual Studio 中运行宏直到文件末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9813188/

相关文章:

c# - .NET HEX颜色对于HTML来说太长

c# - 在 Metro App 中创建样式 BasedOn StandardStyles.xaml

使用ascii在C中大写字母

c# - 从 CSProj 列表生成解决方案文件

visual-studio-2008 - 如何更改Visual Studio 2008的注册公司名称?

c# - 在 .NET 数组内部绑定(bind) JSON 对象

c# - 用 * 过滤,这将限制所有以 Null 开头的值?

git - 如何将 Visual Studio 2015 连接到现有的 Gitlab 项目?

c# - Resx 资源(本地化)在调试中工作但在 MSI 安装程序中不工作

visual-studio-2008 - 使用仿真模式在nvcc中出现错误