Anyone who has tried scripting in Windows will have found that the GUI (the Graphical User Interface) is very limited, in fact the only user interaction is via :
- the command line
- input boxes
- message boxes
Each one is useful, but not very pretty and very long winded to use - if this was, for example, an application for obtaining the stock quotes for a number of companies from Yahoo! Finance, then the user may accept typing in two or three companies, but not ten or fifteen.
No, what the user would prefer to have is an application where they can drag and drop date, or use Combo (drop-down) boxes; which means, of course, that the developer will have to look into a full blown programming language, all the overheads that will incur.
That's unless the developer knows about HTAs - HTML Applications.
What is an HTA
An HTA is an application that uses HTML (HyperText Markup Language) as its user interface (just like any web page), but it can run without the restrictions built into web browsers. For instance a web browser script may not access local files or the user's network; and for all of this the developer just needs a text editor.
Creating an HTA
Any HTA consists of three sections:
- the <HTA:Application> section controls the appearance of the HTA window
- the <script> section contains the functionality of the HTA
- the <body> section is where the GUI itself resides
This simple structure can be used to quickly develop a useful application - in this case one which will display a different message according the the selection of a drop-down box; and it's worth noting that both VBScript and Javascript can be used (as shown in this example):
Conclusion
The HTA is not run via a web browser. Instead, if the code above is saved to a file with a .hta extension then it can be run by double clicking on its icon from Windows explorer. Of course, the file can also be moved to the Desktop or the start menu to create a simple desktop application - one that needs no additional software installing, just an ordinary Windows PC.