Page 1 of 1

[SOLVED] How to link contextually to a .chm file.

Posted: 08 Feb 2015, 15:52
by Capbat
Hi all.

I have written a script and a .chm file. I manage to call up the .chm file when user triggers a menu option or press the F1 key. Using the Run, %A_WorkingDir%\Help\MyApp.chm.
What I would like to find out is how can I go specifically to particular region of the .chm file.
So that the request would be context sensitive.

Can you point me in a direction here or on the web. I have searched, but I might have not used the proper searching criteria.

Thanks

Bat

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 16:59
by lexikos

Code: Select all

Loop %A_AhkPath%\..\AutoHotkey.chm
    path := A_LoopFileFullPath
topic := "/docs/Functions.htm"

Run hh.exe ms-its:%path%::%topic%

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 17:18
by Capbat
Thanks Lexikos.
But I am no certain I understand your proposal.
My script is an EXE file that will be running on machine that will most probably don't have a path to AHK.
I understand that I might have to identify the topic!
And I don't know what is HH.exe. Edit I just found it.
I am green with AHK.
Maybe these clarification will help you help me better. ;-)

Thanks

Bat

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 17:44
by enthused
Hey Capbat I think you have to point to the chm file and send the topic:

Code: Select all

Loop %A_AhkPath%\Help\MyApp.chm
    path := A_LoopFileFullPath
topic := "/docs/whatevertopic.htm"

Run hh.exe ms-its:%path%::%topic%
What is hh.exe:
http://www.help-info.de/en/Help_Info_HTMLHelp/hh_command.htm wrote:HH.EXE is distributed with HTML Help so you can rely on it being present. It lives in the Windows folder and has a limited number of command-line options. HH.EXE is associated with .CHM files. So double-click a *.CHM file and Windows will open the file using HH.EXE. Its a very small file, it mostly passes the help filename onto a HH API library. HH.EXE is not single instance, if you open a CHM file three times using HH.EXE, then three help windows will appear.

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 17:52
by lexikos
The intention of putting variables in the example was that you can clearly see where to put the path and where to put the topic. You obviously don't need to use the AutoHotkey help file, but everyone who has AutoHotkey installed can run the example. Just set or replace the variables as needed.

The loop is not needed if you have the full path (or probably at all). I only used it to resolve Dir\AutoHotkey.exe\..\AutoHotkey.chm to Dir\AutoHotkey.chm.

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 18:04
by Capbat
Thanks Enthused.
It's getting clearer. I see that Lexikos was just giving me an example, that's why I was wandering about the AHK.chm
Now what I have to figure out is in order to find the topic I must know from where the request for help was initiated the F1 or Menu button won't tell me. I guess I would have to put buttons for help at specific places to find out from where they where originating?

Tks I am moving forward. :-)

Bat

Re: How to link contextually to a .chm file.

Posted: 08 Feb 2015, 18:09
by enthused
Capbat wrote:I guess I would have to put buttons for help at specific places to find out from where they where originating?
you probably need to see where the cursor is and copy the word at the boundary of the cursor to %topic%

That is my understanding of how F1 pulls the topic if available.

Re: How to link contextually to a .chm file.

Posted: 09 Feb 2015, 02:11
by MJs
you need to sync your chm and script in a simple way: what shows what and when
and you need to know what trigers the help file, is it the focused control? is it the dialogbox? is it a menu item or context menu? is it a MsgBox? (may need some simple work)
and you may try with WM_HELP message (may need some work)

[SOLVED] How to link contextually to a .chm file.

Posted: 09 Feb 2015, 14:38
by Capbat
Thanks MJs.
I managed to get it all working thanks to mainly Lexikos and enthused.
Like you say I will have to monitor Where I Are ;-). Using Editable object and focused Btns and Controls to feed my %Topic% variable, a work in progress.
But the original problem is SOLVED.

Thanks again to you all.

Bat