次の方法で共有


HTML Applications (HTAs)

HTML Applications (HTAs) are DHTML pages that have full local privileges.  They've been around for a long time, but a colleague recently inquired so it was worth remembering.  They're frequently used for splash screens on CD autoruns or as frontends to Windows Scripting Host (WSH) scripts.

HTAs are suited to many uses, whether you are prototyping, making wizards, or building full-scale applications. Whatever DHTML and script deliver nowforms, multimedia, Web applications, HTML editors, and browsers so can HTAs...and then some (from MSDN)

Creating them is super easy, just create an HTML page and give it the extension .hta   It will run with full privileges on the local machine which lets you tap into the local object store (such as Office automation) and common Script Runtime objects like FileSystemObject.  You also get more refined control how the browser appears to the user.

References There's a list of good references about doing HTA/DHTML/CSS/Script work on an old post of mine that I use daily when doing web work, Favorite Web Design Links
   
Sample Code HTML Application Example.zip is a tiny little example written for my colleague.  I've split out the CSS and utility script routine into separate files, so you'll want to unpack to a directory first, then run the .HTA file.  CD Autorun.zip is an example showing how to create a splash screen for CD autorun.
   
Model View Controller If you do much scripting, using an HTA is a very easy way to add a user interface to your scripts.  It is easy to separate the view & controller by using a .js or .vb file for your controller and command line support, and use an HTA for a nice DHTML user interface view.

For more powerful and modern scripting, check out JPSoft's 4NT, PowerShell, or IronPython.  But I must say, for simplicity and cross-PC support, it's still hard to beet the effective simplicity of HTAs.

Comments

  • Anonymous
    May 09, 2007
    Download ShellExec ( source code ) Here's a really simple but surprisingly useful little tool. It performs