There are two separate problems here. First, how to open a CHM file at all from Lua, and second, how to open it at a specific page.
The first is straightforward, making the assumption that you are on a Windows box and things are set up in the usual way. Given that, os.execute("example.chm")
will launch the CHM file in the help viewer, and block until the viewer exits. To open it without blocking execution, you probably want to do os.execute("start example.chm")
.
If you are not using Windows, then you will need to figure out the name of your preferred CHM viewer for your platform if the first method does not work.
To get a link to a specific page within a CHM, you will need to know the name of the page. This is not easy to discover unless you have access to the original sources to the CHM, or have HTML Help developer tools available to disassemble the CHM and inspect its content. Note that the page name might also include some path information that will need to match exactly. For best results, look in the help project's HHP
file, in the [FILES]
section, for the name of the desired page as known to the help system.
Given that name, invoke hh.exe
something like this: os.execute("start hh example.chm::/path/to/my/page.html")
.