【问题标题】:Open a .chm from a hta从 hta 打开 .chm
【发布时间】:2015-03-30 09:02:00
【问题描述】:

我有一个 HTA,为此我制作了一个 .chm 帮助文件。我想要一个 JavaScript 或 VBScript 函数从 HTA 打开一个 .chm 文件,以便能够制作这样的帮助按钮:

<button onclick="//I don't know what to put here">Help</button>

我该怎么做?

【问题讨论】:

  • 通过命令行:new ActiveXObject('WScript.Shell').Run("A_Path_To_CHM_File");.
  • 由于您最近问了很多 HTA 问题,我建议您下载legacy Windows Script 5.6 Documentation。并不是说询问会不好,但是在某些情况下,文档可能是获取信息的更快方法; )。

标签: javascript vbscript hta chm


【解决方案1】:

在带有 HTA 的 vbscript 中,我们可以这样:

<html>
<Title>How to open VBSCRIP5.CHM</Title>
<head>
<HTA:APPLICATION
ICON="cmd.exe"
APPLICATIONNAME = "How to open VBSCRIP5.CHM"
BORDER="dialog"
BORDERSTYLE="complex"
>
<style>
body{
background-color: DarkOrange;
}
</style>
</head>
<script type="text/Vbscript">
Sub OpenCHMFile()
Dim CHMFile
CHMFile = "C:\Program Files\Microsoft Office\Office12\1036\VBSCRIP5.CHM"
Call Launch(CHMFile)
End Sub
'********************************************
Sub Launch(MyProgram)
Dim ws,Result
Set ws = CreateObject("wscript.Shell")
Result = ws.run(DblQuote(MyProgram),1,False)
End Sub
'********************************************
Function DblQuote(Str)
    DblQuote = Chr(34) & Str & Chr(34)
End Function
'********************************************
</script>
<body text="white">
<center>
<input type="button" onClick="OpenCHMFile()" value="Open the help file">
</center>
</body>
</html>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-13
    • 2012-01-01
    • 1970-01-01
    • 2015-12-04
    • 2013-01-16
    • 2017-03-10
    相关资源
    最近更新 更多