Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are HTML applications?

Tags:

html

hta

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?
like image 335
sub Avatar asked Feb 28 '23 05:02

sub


2 Answers

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.

like image 62
Todd Avatar answered Mar 08 '23 05:03

Todd


See here for Introduction to HTML Applications (HTAs).

like image 27
Alex K. Avatar answered Mar 08 '23 04:03

Alex K.