Open to help topic with header and TOC

This section is for programmers. Please use it for all discussons on interfacing help with your applications and related subjects.

Moderators: Alexander Halser, Michael Schwarzl

Open to help topic with header and TOC

Unread postby Steve Nicholson » Wed Dec 06, 2017 3:07 am

We're exploring replacing our CHM file with an EWriter eBook with integrated viewer. We're opening the EWriter file from a desktop C# program like this:

Code: Select all
            var helpPath = Path.Combine(new[] { AppDomain.CurrentDomain.BaseDirectory, Settings.Default.HelpFile });
            _helpProcess = new Process
            {
               StartInfo =
               {
                  FileName = helpPath,
                  // Arguments needs to be enclosed in quotes
                  Arguments = "\"" + e.HelpTopic + "\""
               }
            };
            _helpProcess.Start();


The help viewer loads, but there is no header or table of contents like there is if I start the viewer with no arguments. How can I open to a specific topic and retain the header and table of contents?
Steve Nicholson
 
Posts: 5
Joined: Tue Nov 28, 2017 9:36 pm

Re: Open to help topic with header and TOC

Unread postby Tim Green » Wed Dec 06, 2017 9:58 am

Hi Steve,

It's not possible to see exactly what you're doing here because you don't show the contents of your variable with the topic reference. See the instructions for linking to EWriter here:

https://helpandmanual.com/help/index.ht ... writer.htm

The problem is probably the inclusion of the double quotes, which is a little tricky here. Here is what Microsoft writes about it:

Arguments are parsed and interpreted by the target application, so must align with the expectations of that application. For.NET applications as demonstrated in the Examples below, spaces are interpreted as a separator between multiple arguments. A single argument that includes spaces must be surrounded by quotation marks, but those quotation marks are not carried through to the target application. In include quotation marks in the final parsed argument, triple-escape each mark.

And here is what they mean by "triple-escaping" (their example):

Code: Select all
 // Triple-escape quotation marks to include the character in the final argument received
            // by the target process. Equivalent verbatim string: @"/a /b:""""""quoted string""""""";
            //  [0] = /a
            //  [1] = /b:"quoted string"
            startInfo.Arguments = "/a /b:\"\"\"quoted string\"\"\"";
            Process.Start(startInfo);
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
 
Posts: 19549
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany

Re: Open to help topic with header and TOC

Unread postby Steve Nicholson » Wed Dec 06, 2017 5:11 pm

Thanks for the link. My problem was that I was leaving off the "index.html?" before the topic. On the page https://helpandmanual.com/help/index.ht ... ebhelp.htm it says "Normally, a link to a topic file will automatically display the entire help with the TOC even if you don't include the index.html part of the URL" so it seems like I shouldn't need to specify "index.html?".
Steve Nicholson
 
Posts: 5
Joined: Tue Nov 28, 2017 9:36 pm

Re: Open to help topic with header and TOC

Unread postby Tim Green » Thu Dec 07, 2017 8:20 am

Hi Steve,

Ah, it wasn't clear from your original posting what you were getting, and since I couldn't see the content of your variable holding the actual address I couldn't comment on that either. Note that you shouldn't refer to the WebHelp documentation when working with EWriter, because the latter works differently in a number of ways, even though its contents are WebHelp.

it says "Normally, a link to a topic file will automatically display the entire help with the TOC

Thanks for noticing this. That text needs to be updated because this setting is no longer on by default. In WebHelp on the Internet the automatic redirect that reloads the full user interface when a topic is addressed on its own has to be off, because Google interprets the reload as "duplicate content" and an attempt to artificially increase click count, and then stops indexing the site.

You can turn this on again for regular skins in Configuration > Publishing Options > WebHelp > Navigation with the option "When a topic is loaded outside the navigation frame...". However I would NOT use this for your EWriter calls. It is much better to do this directly with the index.html?topic.htm syntax.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Tim Green
Site Admin
 
Posts: 19549
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany

Re: Open to help topic with header and TOC

Unread postby Steve Nicholson » Thu Dec 07, 2017 6:23 pm

Thanks for the help. The "index.html?topic.htm" syntax is working great. Our product manager approved switching to the EWriter format.
Steve Nicholson
 
Posts: 5
Joined: Tue Nov 28, 2017 9:36 pm


Return to Programmers' Corner

Who is online

Users browsing this forum: No registered users and 2 guests