什么是 HTML 应用程序?
我最近在我的 Win XP 机器上偶然发现了一些被描述为“HTML 应用程序”的文件。
- 这些是什么?
- 谁会使用它们?为什么我的电脑上有大约 2 到 3 个?
- 它们一般如何工作?我的意思是嘿 - HTML 用于向文本添加格式 - HTML 应用程序?什么?微软?
I recenty stumbled upon some files described as "HTML Applications" on my Win XP machine.
- What are they?
- Who would ever use them? Why do I have like 2 or 3 of them on my PC?
- How do they generally work? I mean hey - HTML is for adding formatting to text - HTML Applications? What the? Microsoft?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HTA 非常适合 VB 脚本之类的东西,您需要除 MsgBox 或控制台窗口之外的界面。
由于它是 HTML,因此您可以使用按钮、文本区域、复选框等向用户显示信息并从他们那里获取输入,并使用 CSS 来设置所有样式。由于 HTA 在本地计算机上运行,因此您可以使用 VBScript 进行计算和文件访问、使用 WMI 进行系统管理、使用 COM 对象进行程序自动化、使用 ADO 进行数据访问等等。
我曾经编写过一个 HTA,它可以在用户计算机上的公共文件夹中安装、更新和比较 Word 模板。用户可以在公共文件夹旁边查看模板文件夹,以了解它们是否是最新的,如果不是最新的,则单击“更新”按钮。
另一个管理和验证用户计算机上程序的安装,必要时复制 exe,确保注册表项设置正确,在桌面上放置快捷方式,让用户测试并查看安装结果,以及很快。它还将所有这些信息记录到一个公共位置供我检查。
我最大的 HTA 项目之一是项目经理系统。该界面向我展示了我正在进行的所有 Excel、Word 或 Access 项目。它将在特定环境中打开所选项目,并向我展示它的所有部分。它允许我使用 VBE 自动化(Visual Basic 编辑器 COM 接口)从公共库导入和导出代码模块。
我将把一个放在一起来显示用户计算机上当前和“失效”的打印机驱动程序。在我通过电话指导他们的情况下,他们将运行 HTA,其中会列出所有已安装的打印机。他们会在想要保留的内容旁边打勾,然后点击按钮删除所有其他内容。对他们来说相当容易,而且我不用去每台电脑上修复这个问题。
其中许多东西仅在 Windows 环境中有意义,但您也可以用它编写一些非常通用的东西。任何可以用 VBScript 或 JScript (JavaScript) 表达并且需要 HTML/CSS 前端的内容都是 HTA 的良好候选者。我什至曾经在其中写过一个基本的网络聊天系统。
有很多小型 HTA 可用于将数据从一种格式转换为另一种格式,例如将逗号分隔的数据转换为柱状数据,或者添加或删除各种格式(例如可打印引号的转义码)、将十六进制格式的文本转换为纯文本等等。在。将文本复制到一个输入文本区域,检查几个选项并按“执行”按钮,然后从输出文本区域复制转换后的数据。我写的一个是 SQL 格式化程序。它将获取 SQL 代码并将其包装为 VB 或 Delphi 字符串,并且
从包装回到纯 SQL 代码,使用基本的缩进和“漂亮的打印”来清理它。
我不再像以前那样使用 HTA,但仍然认为对于适合该领域的工作来说,它们是一项非常酷的技术。
HTAs are good for things like VB scripts that you want an interface for other than MsgBox or a console window.
Since it's HTML, you can use buttons, text areas, check boxes, etc to show information to the user and get input from them, and use CSS to style it all. Since HTAs run on the local machine, you have access to everything you can do with VBScript for computation and file access, WMI for system management, program automation with COM objects, data access with ADO, and so on.
I once wrote an HTA that installs, updates, and compares Word templates on a user's machine from a common folder. The user can see their template folder next to the common folder to know if they are up to date, and hit the Update button if not.
Another one manages and verifies the installation of a program on a user's computer, copying over the exe if necessary, making sure registry entries are set correctly, putting a shortcut on the desktop, letting the user test and see the results of the installation, and so on. It also logs all of this info to a common place for me to check on.
One of my biggest HTA projects was a Project Manager system. The interface showed me all of the Excel, Word or Access projects I had going on. It would open the selected project in its particular environment, and showed me all of the pieces of it. It allowed me to import and export code modules from a common library using VBE automation (the Visual Basic Editor COM interface).
I'm about to put one together to show current and "dead" printer drivers on a user's machine. With me coaching them over the phone, they will run the HTA which will list all of the installed printers. They will put a check mark next to the ones they want to keep, then hit a button to delete all of the others. Fairly easy for them, and saves me from going to each and every PC to fix this.
Many of these kinds of things only make sense in a Windows environment, but you can write some pretty general purpose stuff with it too. Anything you can express in VBScript or JScript (JavaScript) and want an HTML/CSS front on is a good candidate for an HTA. I also even wrote a basic network chat system in it at one point.
There are lots of little HTAs around for converting data from one format to another, say converting comma separated data to columnar, or adding or removing various kinds of formatting like quote-printable escape codes, converting hex formatted text into plain text, and on and on. Copy text into one input text area, check a few options and press the Go button, then copy the converted data from the output text area. One I wrote was an SQL formatter. It would take SQL code and wrap it up as either a VB or Delphi string, and also
go from wrapped back to plain SQL code, with basic indenting and "pretty printing" to clean it up.
I don't do as much with HTAs as I used to, but still think they are a pretty cool technology for the kinds of jobs that fit in that niche.
请参阅此处HTML 应用程序 (HTA) 简介。
See here for Introduction to HTML Applications (HTAs).