20
$\begingroup$

In notebooks you can press F1 (or Shift+F1 for a new window) to:

  1. open the help page of the marked Symbol or the Symbol under the cursor in the Documentation Center
  2. to search the Documentation Center, if no direct page was available

Question: Is it possible to achieve exactly this behavior with a function searchDoc[input_String]?

Related issues

Related 1: As stated in the documentation to Hyperlink, this here opens the documentation of Plot in a new window

NotebookOpen["paclet:/ref/Plot"]

but if the "paclet" does not exist, an error message appears instead of a search in the docs.

Related 2: It's possible to mimic the behavior of F1 with a FrontEndToken.

Button["HEEELP!!", FrontEndExecute[FrontEndToken["SelectionHelpDialog"]]]

This button shows the help of marked symbols or of symbols under the cursor. Problem here is, that it searches always the selected expression. Maybe there exists something similar which can take an input string.

Related 3: One of the probably biggest resource of information can be found in package

$InstallationDirectory/AddOns/Applications/DocumentationSearch

This seems to contain the functions and helpers which are actually used in the Documentation Center. See for instance what

DocumentationSearch`SearchDocumentation["Graphics"]

gives.

$\endgroup$
22
$\begingroup$

The function you are looking for is Documentation`HelpLookup["some input"]. This is the function that is executed when you hit F1 (after the front end figures out what is under the cursor).

$\endgroup$
  • 1
    $\begingroup$ Awesome!! Exactly what I was looking for. $\endgroup$ – halirutan Dec 17 '12 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.