Tag Archives: Command Line

Making F1 Google Search for Visual Studio

Start Visual Studio 2008 OR Visual Studio 2010

  1. From Menu bar select “Tools->Macros->New Macro Project
  2. Name the project “MyGoogleSearch
  3. Rename the default Module1 to “GoogleSearch” (right click on the module name in the left hand pan, select “Rename”)
  4. Copy following code and paste into the module body

Sub doGoogleSearch()

    Dim url As String
    Dim search As TextSelection = DTE.ActiveDocument.Selection()

    If search.Text <> "" Then
        url = "www.google.com/search?q=" + search.Text
    Else
        url = "www.google.com/"
    End If

    ' Run Command: "firefox.exe -new-tab http://www.google.com"

    Dim cmd As System.Diagnostics.Process = New System.Diagnostics.Process()

    cmd.StartInfo.Arguments += " -new-tab " + url

    cmd.StartInfo.FileName = "firefox"

    cmd.Start()

End Sub
  1. Build and save your “GoogleSearch” module.
  2. From menu bar  “Tools->Options->Environment->Keyboard
  3. In the “Show commands containing:” input textbox, type “Google” (to search your newly created macro).
  4. Go to the “Press shortcut keys” box, and press F1 and then Assign button
  5. Press OK.

Select text in your Visual Studio Environment that you want to google and press F1, now google searches for whatever you highlighted.
Your search result will be appeared by open New Tab in Firefox (no matter if firefox is already running ).

enjoy your development and google search interactive format.  Save your time of text copy/paste or typing the terms you want to google.