Use Lua To Open .chm At Defined Index Page

扶醉桌前 提交于 2019-12-22 01:23:02

问题


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:


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




回答2:


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



来源:https://stackoverflow.com/questions/3097601/use-lua-to-open-chm-at-defined-index-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!