Sunday, December 14, 2008

Visual Studio MACRO

I have been using Visual Studio IDE`s from a long time. I just love Visual Studio IDE. It is the best thing from MS.

I just love tools. I create tools to make my work faster. This MACRO that I have written will help you google your doubts just by right clicking in the IDE. is`nt it easy

Follow the following steps to add this MACRO to your VS IDE,
  • Open VS IDE.
  • Press Alt+F11 or go to Tools->Macros->Macros IDE.
  • Right click on MyMacros->Add->Add New Item.
  • Select Module in the dialog box and name it WebLookUp.
  • Paste the following code between
Public Module WebLookUp
// Code goes here
End Module

  • Once you are done, your MACRO code should look like this,
Public Module WebLookUp
Sub LookUpOnTheWeb()
Dim selectedText As TextSelection = DTE.ActiveDocument.Selection
If selectedText.Text.Length = 0 Then
Return
End If
Dim args As String = """http://www.google.com/search?q=" + selectedText.Text + """"
Dim commandString = "c:\Program Files\Mozilla Firefox\firefox.exe -url " + args
Shell(commandString, AppWinStyle.MaximizedFocus, True, 100)
End Sub
End Module

This MACRO use firefox as the web browser. If you need to use some other browser just replace firefox with path for your loved browser.

Once you are done with the MACRO, now is the time to add it to the Context Menu,
to do this follow these links, Link1, Link2, Link3

Hope you guys like it. Have fun googling :)

No comments:

Post a Comment