Re: How to bring up specific doc page programmatically?

*To*: mathgroup at smc.vnet.net*Subject*: [mg114363] Re: How to bring up specific doc page programmatically?*From*: John Fultz <jfultz at wolfram.com>*Date*: Thu, 2 Dec 2010 05:39:23 -0500 (EST)

FrontEndExecute[ FrontEndToken[ "OpenHelpLink", {"tutorial/Operators", FrontEnd`DefaultHelpViewerNotebook[]}]] If you want to always bring up a new window (i.e., never reuse an existing help window), then the following will suffice: FrontEndExecute[FrontEndToken["OpenHelpLink", "tutorial/Operators"]] Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Wed, 1 Dec 2010 02:10:57 -0500 (EST), kj wrote: > Is there a way to bring up a specific documentation page > programmatically? IOW, is there some Mathematica expression whose > evaluation would cause some specific Documentation Center page > (e.g., the one for tutorial/Operators) to come come up? (BTW, > tutorial/Operators here is just a random example; I want to be able > to do this for any arbitrary documentation page, or indeed any > string, as one would type it in the location bar of the documentation > browser.) > > This is the best I've managed so far: > > PopDoc[s_] :== Module[{nb}, > nb == First@Notebooks[]; > NotebookWrite[nb, s, All]; > FrontEndExecute[FrontEndToken["SelectionHelpDialog"]]; > NotebookWrite[nb, "", All]; > ] > > Evaluating PopDoc["tutorial/Operators"] does indeed bring up the > corresponding doc page, but the process has two problems: 1) it > clutters the notebook with an unnecessary cell; and 2) it BEEPS. > I can live with the clutter, but the beep drives me nuts. > > Both problems are related to the fact that the only way I have > found to bring up a doc page programmatically requires that the > notebook's current selection be set to the string representing the > page (e.g. "tutorial/Operators"). This is what causes the first > problem (the unnecessary cell is where the this dummy selection > gets placed). The second problem occurs when I wipe out the dummy > selection. Help > Why the Beep? says that > > There is a problem with the position of the text insertion point. > The insertion point might not be where you intended. > > The optimal solution, of course, would be a way to bring up the > desired page without having to fiddle with the selection at all. > That would solve both problems in one swoop. The next best solution > would be a way to set the selection that is invisible to the user, > so that no extra cells get created, and there's no need to wipe > out the dummy selection. Absent any of these alternatives, I'd > settle for some way to turn off the beeping (or even just muting > the volume just long enough to make the beep inaudible). > > TIA! > > ~kj