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

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Capbat
Posts: 101
Joined: 17 May 2014, 13:33
Location: Québec Canada

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

08 Feb 2015, 15:52

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
Last edited by Capbat on 09 Feb 2015, 14:39, edited 1 time in total.
lexikos
Posts: 6488
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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

08 Feb 2015, 16:59

Code: Select all

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

Run hh.exe ms-its:%path%::%topic%
User avatar
Capbat
Posts: 101
Joined: 17 May 2014, 13:33
Location: Québec Canada

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

08 Feb 2015, 17:18

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
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

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

08 Feb 2015, 17:44

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.
lexikos
Posts: 6488
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

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

08 Feb 2015, 17:52

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.
User avatar
Capbat
Posts: 101
Joined: 17 May 2014, 13:33
Location: Québec Canada

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

08 Feb 2015, 18:04

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
enthused
Posts: 94
Joined: 27 Dec 2014, 03:28

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

08 Feb 2015, 18:09

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.
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

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

09 Feb 2015, 02:11

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)
User avatar
Capbat
Posts: 101
Joined: 17 May 2014, 13:33
Location: Québec Canada

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

09 Feb 2015, 14:38

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, blue83, Frosti, Google [Bot], Odlanir, rdeyoung, TAC109, teadrinker and 156 guests