Jump to content
  • Advertisement
Sign in to follow this  
roos

Question about macros in vs .net 2k3

This topic is 4874 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I recorded a macro to draw comment bars... you know, these things:
//---------------------------------------------------
//  Comment here
//---------------------------------------------------
It works, and I figured out how to bind it to a key like Alt+3. However, when I try to undo it, it "undoes" it part by part (as if I had typed it) instead of erasing the whole comment bar at once. Does anyone know any workaround for this? I tried consolidating some of the lines of the macro code... For example: DTE.ActiveDocument.Selection.Text = "//--------------------" DTE.ActiveDocument.Selection.NewLine() DTE.ActiveDocument.Selection.Text = "//" DTE.ActiveDocument.Selection.NewLine() DTE.ActiveDocument.Selection.Text = "//--------------------" I tried changing this to: DTE.ActiveDocument.Selection.Text = "//--------------------" + chr(13) + "//" + chr(13) + "//------------------" However, it still treats it as separate elements :( Well, it's not so bad but it'd be nice if it worked perfectly... Thanks! roos

Share this post


Link to post
Share on other sites
Advertisement
I don't know, but that is such an awesome idea that I'm gonna implement it myself. I'll let ya know if I find a solution (although I think it's likely it can't be avoided).

Share this post


Link to post
Share on other sites
OMG, macros rock so much. There are a billion things I can do with this; I only wish I found out about these things earlier. Kudos man.

Share this post


Link to post
Share on other sites
Hehe, I'm glad it was helpful to you :)

Btw if anyone else is curious here's a 30 second guide to how to use macros in vs .net 2k3...

1. Press CTRL+Shift+R to begin recording the macro. (Can also be accessed via Tools->Macros->Start recording or something like that)

2. Type out the following:


//-------------------------------------------------------
// Text
//-------------------------------------------------------


3. Highlight the word "Text". The reason for doing this is so that, every time you place a comment bar, the text is highlighted so you can type in the actual text and it will replace the word "Text"

4. Stop recording the macro by pressing CTRL+Shift+R again.

5. If you want to preview the effect of the macro before saving it, press CTRL+Shift+P to execute the macro.

6. Go to Tools->Macros->Save Temporary Macro, and type in the name for your macro. (e.g. CommentBarMaker).

7. Now your macro is saved. Go to Tools->Options->Environment->General->Keyboard. Here, you'll see a list of commands. Find the one called something like Macros.MyMacros.RecordingModule.CommentBarMaker, and assign it whatever key you want.


That's it more or less... I might have glossed over something but it should be enough to figure it out :)

roos

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!