tags:

views:

65

answers:

2

I wish to open a specific page within a .chm file from lua, but can not find any resources that would instruct me as to how how this task may be accomplished. If someone could provide some code that would open an index page named "Test2" in a file named "TestFile.chm" from lua I would greatly appreciate it.

Thank you very much :)

+1  A: 

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").

RBerteig
A: 

shellexecuting ms_its://example.chm::/path/to/mypage.html might also help

Marco van de Voort