Macro in IDE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Francois Soucy

    Macro in IDE

    Hi All,

    I would like to know if it's possible to fire a event whenever I add
    a new class file to my project? What I want is to automate the process of
    adding some region and header comment to each new file that I add to my
    project. It's possible? If yes can you give me a direction?

    Give you an example:
    In the Project Menu I add a class and name it Something.vb
    The the "macro event" will add these thing automaticly:

    '************** ******
    'Francois
    ' 50/05/2005
    '
    'This class do some things
    '************** *******

    Public Class Something

    #region "Declaratio n"
    #end region

    #region "Methodes"
    #end region

    ....and so on

    end class





    Thank
    Francois

    Sorry for my english


  • Cor Ligthert

    #2
    Re: Macro in IDE

    Francois,

    Why would you do something generic in the design time of your program, when
    you can do it at runtime instead. (I know one reason, however that is in my
    opinion spending time with nothing).

    I am curious what it can be

    Cor


    Comment

    • Ken Tucker [MVP]

      #3
      RE: Macro in IDE

      Hi,

      Change project templates


      DX Core is free framework from developers express for extending visual studio
      Write code with CodeRush for Visual Studio at the speed of thought. Find and fix defects. Refactor with ease. Create Tests Instantly.


      Ken
      --------------------------

      "Francois Soucy" wrote:
      [color=blue]
      > Hi All,
      >
      > I would like to know if it's possible to fire a event whenever I add
      > a new class file to my project? What I want is to automate the process of
      > adding some region and header comment to each new file that I add to my
      > project. It's possible? If yes can you give me a direction?
      >
      > Give you an example:
      > In the Project Menu I add a class and name it Something.vb
      > The the "macro event" will add these thing automaticly:
      >
      > '************** ******
      > 'Francois
      > ' 50/05/2005
      > '
      > 'This class do some things
      > '************** *******
      >
      > Public Class Something
      >
      > #region "Declaratio n"
      > #end region
      >
      > #region "Methodes"
      > #end region
      >
      > ....and so on
      >
      > end class
      >
      >
      >
      >
      >
      > Thank
      > Francois
      >
      > Sorry for my english
      >
      >
      >[/color]

      Comment

      • Francois Soucy

        #4
        Re: Macro in IDE

        I don't know How I could do something like I want in runtime? It make no
        sense for me. Ken Tucker show me a good solution.

        Francois

        "Cor Ligthert" <notmyfirstname @planet.nl> a écrit dans le message de news:
        uvL4al0YFHA.364 8@TK2MSFTNGP14. phx.gbl...[color=blue]
        > Francois,
        >
        > Why would you do something generic in the design time of your program,
        > when you can do it at runtime instead. (I know one reason, however that is
        > in my opinion spending time with nothing).
        >
        > I am curious what it can be
        >
        > Cor
        >[/color]


        Comment

        • Carlos J. Quintero [.NET MVP]

          #5
          Re: Macro in IDE

          Hi Francois,

          In the Macros IDE, open the EnvironmentEven ts and use the
          DocumentEvents_ DocumentOpened event. You must cast Document to TextDocument,
          guess if the document is new or not and if it is new, then use something
          like TextDocument.St artPoint.Create EditPoint.Inser t(myheader)

          Another approach is to edit the template used by VS.NET, as described in my
          KB article pointed by Ken.

          Also, my add-in (below) allows you to do that with a single mouse click or
          keystroke, and another feature allows you to verify that each file has a
          compliant header.

          --

          Best regards,

          Carlos J. Quintero

          MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
          You can code, design and document much faster.
          Free resources for add-in developers:
          MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.


          "Francois Soucy" <Root@127.0.0.1 > escribió en el mensaje
          news:eoqiYmzYFH A.4088@TK2MSFTN GP15.phx.gbl...[color=blue]
          > Hi All,
          >
          > I would like to know if it's possible to fire a event whenever I
          > add a new class file to my project? What I want is to automate the process
          > of adding some region and header comment to each new file that I add to my
          > project. It's possible? If yes can you give me a direction?
          >
          > Give you an example:
          > In the Project Menu I add a class and name it Something.vb
          > The the "macro event" will add these thing automaticly:
          >
          > '************** ******
          > 'Francois
          > ' 50/05/2005
          > '
          > 'This class do some things
          > '************** *******
          >
          > Public Class Something
          >
          > #region "Declaratio n"
          > #end region
          >
          > #region "Methodes"
          > #end region
          >
          > ....and so on
          >
          > end class
          >
          >
          >
          >
          >
          > Thank
          > Francois
          >
          > Sorry for my english
          >[/color]


          Comment

          Working...