Search MSDN for a Keyword

This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Search MSDN for a Keyword

Post by jussij »

This Zeus macro will search the MSDN for the word under the cursor:

Code: Select all

'
'        Name: MSDN Macro
'
'      Author: Jussi Jumppanen
'
'    Language: VB Script Macro
'
' Description: This VB Script creates a Document Explorer object
'              to search the MSDN for the current word.
'
'  How To Run: All Zeus macros can be run using the macro execute menu
'              item or they can be bound to the keyboard or they can
'              be attached to the macro drop down or popup menus.
'

Dim oMSDN

Function key_macro()
  On Error Resume Next

  ' create the Document Explorer object
  'Set oMSDN = CreateObject("DExplore.AppObj.7")
  Set oMSDN = CreateObject("DExplore.AppObj")

  If Err.Number = 0 Then
    ' this macro only works for documents
    is_document = zeus.is_document()

    If is_document = 1 Then
      ' get the current word or the marked text
      word = zeus.macro_tag("$WEX")

      ' make sure we have a word
      If Len(word) > 0 Then

        ' See this keey for the collection details:
        '    HKEY_CURRENT_USER\Software\Microsoft\MSDN

        ' set the MSDN collection
        oMSDN.SetCollection "ms-help://MS.VSCC.v80", ""

        ' display the index panel
        oMSDN.Index

        ' search for the current word
        oMSDN.DisplayTopicFromKeyword word

      Else
        ' give some feedback to the user
        zeus.message "Place the cursor on word or mark some text."
      End If

    Else
      ' give some feedback to the user
      zeus.message "This script requires an one document or output window."
    End If

  Else
    ' Document Explorer not supported
    error_message = "The .NET Framework Document Explorer does not appear to be installed on this machine."

    ' display error message in the status bar
    zeus.message error_message

    MsgBox error_message
  End If

End Function

key_macro() 'run the macro
Post Reply