本文介绍了使用Lua在定义的索引页中打开.chm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从lua打开.chm文件中的特定页面,但是找不到任何可以指导我如何完成此任务的资源.如果有人可以提供一些代码来在lua的名为"TestFile.chm"的文件中打开名为"Test2"的索引页,我将不胜感激.

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.

非常感谢:)

推荐答案

这里有两个独立的问题.首先,如何从Lua打开CHM文件,其次,如何在特定页面打开文件.

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.

第一个很简单,即假设您在Windows机器上,并且一切都以通常的方式进行设置.鉴于此,os.execute("example.chm")将在帮助查看器中启动CHM文件,并阻塞直到查看器退出.要在不阻止执行的情况下打开它,您可能需要执行os.execute("start example.chm").

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

如果您未使用Windows,则如果第一种方法不起作用,则需要找出平台首选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.

要获取指向CHM中特定页面的链接,您需要知道页面名称.除非您有权访问CHM的原始资源,或者拥有可用于反汇编CHM并检查其内容的HTML帮助开发人员工具,否则这很难发现.请注意,页面名称可能还包含一些需要完全匹配的路径信息.为了获得最佳效果,请在帮助项目的HHP文件中的[FILES]部分中,查找帮助系统已知的所需页面的名称.

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.

使用该名称,请调用hh.exe,例如:os.execute("start hh example.chm::/path/to/my/page.html").

Given that name, invoke hh.exe something like this: os.execute("start hh example.chm::/path/to/my/page.html").

这篇关于使用Lua在定义的索引页中打开.chm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 08:16