Getting SDK help from an external editor

December 23rd, 2005 by Andy Nicholas - Viewed 14039 times -




If your editor supports the launching of external programs and allows you to insert text to the command line based on your current selection, then you can get context sensitive help from the XSI SDK help file. This will work for both the C++ and scripting SDKs. This snippet shows how to perform this in the Crimson Editor but it will work equally well in any other well supported editor that has this feature.

- – - – - – - – -

If you tend to only use commands in your scripts, then I recommend this method (which only works for commands):

In your editor, find where the settings are for launching external applications via a keyboard shortcut. For Crimson Editor, you can find this in the “Tools->Conf. User Tools” menu.

Enter the command as:

C:\WINDOWS\hh.exe

And the argument as:

mk:@MSITStore:C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm::/$(CurrWord).htm

Note that you’ll need to set the path to the help file so that it’s correct on your system. Also, if you’re not using Crimson Editor, then you’ll need to change where it says $(CurrWord) to the correct macro for your editor, so that it adds the currently selected word to your command argument.

Now just associate this tool with a shortcut key, e.g. F1, and you should now be able to launch the SDK help with a single key press to get instant reference for your command. As I said above, this only works for commands, since it relies on the naming convention of the compiled help.

- – - – - – - – -

If you want to have general context sensitive help that will work with any method, property, or command in your script, then you need to download KeyHH.exe from www.keyworks.net.

Once you’ve installed it, just use these settings:

Enter the command as:

C:\WINDOWS\keyhh.exe

And the argument as:

-myhelp -#klink "$(CurrWord)" C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm

As mentioned above, you’ll need to change the path to work for your help file and change the $(CurrWord) macro to suit your editor.

When you launch this command, it will open the help file in Index view using the word selected in the editor. Unfortunately it doesn’t display the help page automatically, and you still need to double click the entry, but it beats the heck out of having to type it!

7 Responses to “Getting SDK help from an external editor”

  1. Kim Aldis says:

    Here”s a version that”ll work with vim or gvim. Put this code into your _vimrc. It maps the comman to F2. Alter the last two lines if this doesn”t suit. Enjoy, and merry Christmas.

    function XSIhelp()

    ” yank word under cursor into ” buffer
    normal yiw

    ” assign to variable
    let sWord = @”

    ” construct our command
    let sCom = ”C:\WINDOWS\hh.exe C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm::/” . sWord . ”.htm”

    ” and run it.
    let sResponse = system( sCom );

    endfunction

    :map :call XSIhelp()
    :imap :call XSIhelp()

  2. Cool, thanks very much for that Kim. It”d be great if anyone else uses a different editor to the ones mentioned above if you could post how to get this working for yours.

  3. Kim Aldis says:

    Back in the old days, when we used html, I also figured a way, using the same kind of method, of parsing the html docs and echoing out functions that matched the word under the cursor with an option to pick one to insert in the code in place of the word. In many ways this is more useful than bringing up the full docs because often you know what the function does, you just want a reminder of the arguments. Not quite intellisense but a reasonable imitation thereof.

  4. Very cool tip. Such a feature should be also very possible in Microsoft Visual Studio, it has a full SDK for writing macros.

    However I can”t figure out how to do such a straightfoward thing as launch an application (e.g. call a hh.exe)

    I tried going via internet explorer but that DOESN”T work.

    Sub XSISDKHelp()
    Dim win As Window = DTE.ActiveWindow

    Dim ts As TextSelection = win.Selection

    If (ts.Text = “”) Then
    MsgBox(“Select a word to lookup in the SDK help”)
    Exit Sub
    End If

    Dim path
    path = “C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm::/” & ts.Text & “.htm”

    ”DOESN”T WORK
    Dim oApp
    oApp = CreateObject(“InternetExplorer.Application.1″)
    oApp.Visible = True
    oApp.Navigate(path)

    End Sub

    Any one have any ideas?

  5. (Actually I realise that it would, at least, be possible to use this macro to go to the external wiki version of the docs…

    Just change the line above to this:
    path = “http://softimage.wiki.avid.com/sdkdocs/” & ts.Text & “.htm”

    But opening the chm would often be better.

    Also, this approach doesn”t work for the methods of objects, because the path includes the class name.

  6. Hi Andrew,

    I”ve not had a look at how to do it in a macro yet, but you can launch external applications using the “Tools->External Tools…” where you can also add in the currently selected text into the command line as I mentioned above.

    You can also slave it to a keyboard shortcut via the “Customize…” menu, Keyboard” button, and adding the shortcut to one of the “Tools.ExternalCommand(nn)” entries, where (nn) is the numeric position of the external command in the menu.

  7. I just found how to launch an external application with Visual Studio Macros:

    Sub LaunchCalc()
    DTE.ExecuteCommand(“Tools.Shell c:\Windows\System32\calc.exe”)
    End Sub