[SOLVED] HeaderFile / AliasFile not working?

This forum is for all Flare issues related to the Microsoft HTML Help target.
This target produces "CHM" files in the output.
Post Reply
gbusch
Propeller Head
Posts: 44
Joined: Wed Mar 26, 2014 8:52 am
Location: Germany

[SOLVED] HeaderFile / AliasFile not working?

Post by gbusch »

Hi there,

i've read a lot about CSH and how to connect the application to the help file but i just don't get it.

As far as i understand there are two files: a HeaderFile and an AliasFile.
The HeaderFile maps numeric IDs from the application to so called identifiers.
And the AliasFile maps the identifiers to the actual topic.
Am i right?

So i have a HaederFile that says:

Code: Select all

#define foo 12345
and i have an AliasFile that says:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CatapultAliasFile>
    	<Map Name="foo" Link="/Content/Topics/MyFaboulousTopic.htm" />
</CatapultAliasFile>
So when i'm in my application in some dialog and press the "help key" or the "help button" the application passes the numeric ID 12345 to the CHM viewer. And the viewer should know what topic to display: MyFaboulousTopic that describes the benevolent advantages of the awesome dialog of our adorable application. :D

The problem is it doesn't work. :(

By "doesn't work" means: When i press the "help key" or the "help button" in some dialog of my application the CHM help opens correctly but instead of the corresponding topic i see the browser message that the page could not be found.

I can see the TOC to the left and selecting an entry in the TOC opens the selected topic. But obviously there is no mapping between those numeric values and the corresponding topic.

Is there a general misunderstanding?



Some background:

My company develops software for about 20 years now.
We used the well known HTML Workshop to create our CHM help files.
The html files were named exactly like the numeric IDs (12345.htm).
There was no alias.xml
CSH worked nicely.

Now we switched to Flare because of single sourcing etc.
I imported one of our old CHM files into Flare.
Since i cannot work with topics that have just numeric filenames i decided to rename them to appropriate titles (12345.htm -> MyFaboulousTopic.htm).

One of my main thoughts where "How to link the dialogs of our software to the corresponding topic of the new help file if the topic name is different now?"

The solution might be those header- and aliasfiles.
I tried to explain my developer that i would need a header-/aliasfile to map the numeric values to the new topics filenames.
No luck. There just is no headerfile or he just did not understand.
So i have to create the header- and aliasfile by myself.

Tough i'm not a programmer but at least a former webdeveloper i created a php script :lol: that iterates over all numeric named html files, grabs its <title> inside the file, converts it to proper filenames, renames the files, fixes the links in TOC file and creates the header- and aliasfile automatically. So i don't have to change about 1000 and more files "by hand".

I came up with this result...

Filename:

Code: Select all

12345.htm -> MyFaboulousTopic.htm
HeaderFile:

Code: Select all

#define MyFaboulousTopic 12345
AliasFile:

Code: Select all

<Map Name="MyFaboulousTopic" Link="/Content/Topics/MyFaboulousTopic.htm" />
TOC:

Code: Select all

<TocEntry Title="MyFaboulousTopic" Link="/Content/Topics/12345.htm">  ->  <TocEntry Title="MyFaboulousTopic" Link="/Content/Topics/MyFaboulousTopic.htm">
When i open the Flare project everything looks fine.
When i create the target output and view it, everything is okay.
But when i open the CHM file from my application there is just no CSH :(

I decompiled the old CHM file and the CHM file created with Flare to see what's inside.
The old decompiled CHM file has a primitive folder structure:

Code: Select all

|--- html
|    |--- 12345.html
|    ...
|
|--- images
|    |--- someImage.gif
|    ...
|
|--- MyProject.hhc
|--- MyProject.hhk
The decompiled Flare CHM file has this structure:

Code: Select all

|--- Data
|    |--- Skinchm
|    |    |--- lots of images
|    |
|    |--- Alias.xml
|    |--- HelpSystem.xml
|
|--- resources
|    |--- images
|    |--- stylesheets
|
|--- SkinSupport
|    |--- css files
|
|--- topics
|    |--- MyFaboulousTopic.htm
|
|--- _Temp.hhc
|--- _Temp.hhk
|--- Glossary.htm
|--- MyProject.xml
When i look into MyProject.xml i see this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<HelpSystem 
    DefaultUrl="topics/MyFaboulousTopic.htm" 
    Glossary="Content/Glossary.htm" 
    Alias="Content/Data/Alias.xml" 
    Skin="Data/Skinchm/Skin.xml" 
    Skins="CHM" 
    BuildTime="27.03.2014 16:27:05" 
    BuildVersion="9.1.2.0" 
    TargetType="HtmlHelp" 
    SkinTemplateFolder="Skin/" 
    InPreviewMode="false" 
    MoveOutputContentToRoot="false" 
    MakeFileLowerCase="true" 
    UseCustomTopicFileExtension="false" 
/>
The Alias.xml has this content:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<CatapultAliasFile>
    <Map Name="MyFaboulousTopic" Link="topics/myfabouloustopic.htm" ResolvedId="12345" />
</CatapultAliasFile>
I don't see anything wrong here.
How can i check what value is actually passed to the CHM viewer or what is the CHM viewer actually trying to display?

Any help is much apreciated.
Last edited by gbusch on Mon May 12, 2014 7:03 am, edited 3 times in total.
Flare 9.1.2 | Capture 6.0.2 | Windows 8.1
gbusch
Propeller Head
Posts: 44
Joined: Wed Mar 26, 2014 8:52 am
Location: Germany

Re: HeaderFile / AliasFile not working

Post by gbusch »

I opened my chm.file using the commandline:

Code: Select all

hh.exe -mapid 12345 "C:\Program Files (x86)\MySoftware\MyHelpFile.chm"
and it displayed the correct topic.
So it seems to be a problem with our application?
Flare 9.1.2 | Capture 6.0.2 | Windows 8.1
hornetTC
Propeller Head
Posts: 26
Joined: Mon Jan 21, 2013 1:05 am

Re: HeaderFile / AliasFile not working?

Post by hornetTC »

By "doesn't work" means: When i press the "help key" or the "help button" in some dialog of my application the CHM help opens correctly but instead of the corresponding topic i see the browser message that the page could not be found.
I can see the TOC to the left and selecting an entry in the TOC opens the selected topic. But obviously there is no mapping between those numeric values and the corresponding topic.
Given the description, I suspect that the app is loading the CHM via a network share. When a CHM is opened on a network share, the reading pane shows a page not found message.
gbusch
Propeller Head
Posts: 44
Joined: Wed Mar 26, 2014 8:52 am
Location: Germany

Re: HeaderFile / AliasFile not working?

Post by gbusch »

Thanks for the quick reply.
Given the description, I suspect that the app is loading the CHM via a network share.
Nope.
It is all local.

I found the issue.

I talked to the developer and he recalls that we already had used headerfiles and ids many years ago (before i worked at the company) but there were some issues that they just couldn't fix easy. (i need to find a developer with a good memory who has worked in the company since the beginning to get the details)

The issue in the past was solved by ... *cough* ... dropping the whole header-/aliasfile stuff and calling the topic directly by its file name. The method to call the CSH is encapsulated with another method that transforms the ID of the dialog into the value "/html/12345.htm" that is passed to the CHM viewer :roll:

(I should have seen this without looking into our source code because the old CHM files had no alias.xml so the topcis must be called by its filename and not by an id - making the whole idea of "speaking" filenames and header-/aliasfile pointless to me at the moment)

So, Header- and AliasFiles (even my php-auto-generated ones) work as intended.
I need to convince the developer to switch back to use the header-file-stuff instead of the topics filenames...

cheers
Flare 9.1.2 | Capture 6.0.2 | Windows 8.1
Post Reply