open external CHM in a new window

HM5 served us well, now its time has come and it has been replaced... If you have HM5 questions, please post them here.

Moderators: Alexander Halser, Tim Green

Post Reply
Brigitte
Posts: 8
Joined: Thu Sep 24, 2009 7:49 am

open external CHM in a new window

Unread post by Brigitte »

Hi,
I'm trying to link to an external CHM File in a new Window and it doesn't work :-(
Maybe it's not supported?

'NewWin' is supposed to open a new Window.

Works: Topic Link "Test-Intern", Target "inhalt.htm", Help file: (Current), Window: "NewWin"
=> NewWin opens perfectly fine with the Target 'inhalt.htm'

Doesn't work: Topic Link "Test-Extern", Target "Beispiel.htm", Help file: Extern.CHM, Window: "NewWin"
=> 'Beispiel.htm' opens in the same window :-( [same effect using extern.hmxz]

Tested on V 5.2.0 Build 902 & V 5.3.0 Build 955

Secondary question: I'd like to use one of the default jump-buttons to link to my file extern.chm (preferably also in a new window). But all I'm getting here is "Page cannot be displayed" :(

ciao
Brigitte
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Unread post by Tim Green »

Hi Brigitte,

You can link to topics in other CHM files with a file link, which must call the HTML Help viewer as the target with the CHM file as the execution parameter. Also, the external CHM file must be in the same folder as the CHM file containing the link.

Select the Link tool in Write > Insert and choose the File Link option. In the "File name:" field enter:

hh.exe

as the file to link to (this is the help viewer).

Then enter your CHM file and topic details in the "Execution parameters: field", using the following syntax:

Code: Select all

ms-its:helpfile.chm::/topicname.htm#anchor
Where "helpfile.chm" is the name of your help file "topicfile.htm" is the topic ID of the topic you want to link to + ".htm" (all lower case letters!) and "anchor" is the optional ID of an anchor on the page you want to link to. For example:

Code: Select all

ms-its:myhelp.chm::/introduction.htm#note3
Secondary question: I'd like to use one of the default jump-buttons to link to my file extern.chm (preferably also in a new window). But all I'm getting here is "Page cannot be displayed"
Here too, you need to use the ms-its: syntax and the target CHM must be in the same folder, i.e.:

Code: Select all

ms-its:helpfile.chm::/topicname.htm#anchor
However, you can't specify the hh.exe program here so the topic will open in the current help viewer window. There is a way to do this but I'm just putting together the details for it, I'll post instructions shortly.
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.
Brigitte
Posts: 8
Joined: Thu Sep 24, 2009 7:49 am

Unread post by Brigitte »

Hi Tim,
thank you for this information, by using hh.exe it works fine.

Anyway, it's confusing to be able to choose the options (external File, Window != main) in the dialogue and it's not supposed to work 8)

ciao
Brigitte
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Unread post by Tim Green »

Hi Brigitte,

Here are the instructions for making one of the Jump buttons (or the Home button) open an external CHM file (which also has to be in the same folder, of course):

Since it's not possible to put all the code we need in the link itself the trick is to link to a hidden topic containing the code that will automatically open the external CHM in a new window and then jump back to the previous topic that was displayed when the user clicked on the link.
  1. First create a topic without a TOC entry by clicking in Project Explorer > Topic Files and creating a new topic file there. Make a note of the ID -- let's assume the ID is "exwin1".
  2. In this topic deselect "Topic has a separate header" to turn the header off. Then click in the topic, select the HTML Code Object tool in Write > Insert Object and paste in the following block of code:

    Code: Select all

    <object
      width=0
      id=window_opener
      type="application/x-oleobject"
      classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <param
      name="Command"
      value="ShortCut">
    <param
      name="Item1"
      value=",hh.exe,ms-its:helpfile.chm::/topicid.htm#anchorid">
    </object>
    <script type="text/javascript">
    window_opener.hhclick();
    history.back();
    </script>
    You need to edit the ms-its: reference here for the CHM, topic and (optional) anchor you want to open, just as you would the the other ms-its: links. Leave everything else untouched.
  3. Now go to the Jump link setting in the Help Windows section and enter your topic ID + ".htm", in all lower-case letters. So if your topic ID is "exwin1" or EXWIN1" you would enter:

    Code: Select all

    exwin1.htm
That's all there is to it. Now when the user clicks on the Jump button the hidden topic will be displayed so briefly that it will not be visible, the external CHM will open and the current CHM will switch back to the current topic so quickly that the user won't notice anything except that the new window has opened.

Neat, no? 8)
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.
Brigitte
Posts: 8
Joined: Thu Sep 24, 2009 7:49 am

Unread post by Brigitte »

Thank you! This works great and will make another of our users happy 8)

ciao
Brigitte
Willem Gruter
Posts: 1
Joined: Mon Nov 16, 2009 10:17 am

Starting external help file

Unread post by Willem Gruter »

I want to add a few links to other helps files which are located in the same directory.
I have read previous posts on how to use the file link with

hh.exe as the file and parameters below:

ms-its:helpfile.chm::/topicname.htm#anchor

This solution only seems the work when the hh.exe is started in the directory where the help documents are located. Otherwise I get the error message like:

Cannot open file ms-its:verilogtutorial.chm::/introduction.htm.

Anyone seen this before and is there a solution for it?

Thanks in advance,

Willem
[/img]
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Unread post by Tim Green »

Hi Willem,

The Microsoft CHM viewer has bugs that prevent it from handling relative paths correctly. If the CHM is not in the same directory as the link calling it you need to use a full absolute path including a drive letter.
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
cindynotbrady
Posts: 157
Joined: Wed Mar 01, 2006 3:49 pm
Location: Provo, Utah

Re: open external CHM in a new window

Unread post by cindynotbrady »

Hi Tim,

I'm researching this idea for the Jump buttons listed above. And I thought I might have found the answer to my problems. But alas, I think I'm missing a step. Or my sinking, sneaky suspicion is that Microsoft now blocks this work around.

I did exactly as your steps indicated, and when I built it to my desktop, it worked! But then I built it to the folder where our program retrieves the chm files when <F1> is pressed (this is also on a folder on my desktop). But when I access the help from <F1> and click the Jump button I created (that links to an external window), it gives me this error:
masterhelp.png
Is there a quick fix, or maybe this works when it is all combined, or what?
You do not have the required permissions to view the files attached to this post.
User avatar
cindynotbrady
Posts: 157
Joined: Wed Mar 01, 2006 3:49 pm
Location: Provo, Utah

Re: open external CHM in a new window

Unread post by cindynotbrady »

I realize this is the same problem Willem had above. I'm not sure it was clear exactly why I get the error. So let me break it down into steps:

1. I created the chm and combined it on my desktop and the Jump 1 to another chm file (but still in the same folder) worked great.
2. The problem comes later when I combine it all, and all of the links and master files are all together in the same folder, but when I press <F1> to see the help, and then click the Jump 1 icon (which I renamed "Master Help") that's when the error message comes. I have a feeling it has to do with the pesky <F1> issues, which may make it a Microsoft problem? Willem suspects it may have to do with the hh.exe being in the same folder as all the other chms. I tried putting the hh.exe in the same folder, but it still gives me the error message.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: open external CHM in a new window

Unread post by Tim Green »

Hi Cindy,

The problem is probably that you aren't just trying to open a separate CHM file, but the master file of the runtime merged CHM system that the file you are putting the link in is already part of. If you mail me a small demo setup of cut-down projects you are trying to link like this I can check it for you. Save them as single-file HMXZ projects and mail them to support AT ec-software.com (replace the AT with @) and I'll have a look at them.
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
cindynotbrady
Posts: 157
Joined: Wed Mar 01, 2006 3:49 pm
Location: Provo, Utah

Re: open external CHM in a new window

Unread post by cindynotbrady »

Oh, that would be great! I'm sure you can appreciate that you may not get the error due to the <F1> functionality thing. But I'm guessing you can set it through some program that uses <F1> up so you can see the error. I'll send it to you within the hour.
Post Reply