VBScript Scripting Techniques > HTAs
Consider HTAs (HTML Applications) webpages with access to local resources.
Though the engine that executes HTAs (MSHTA.EXE) is essentially the same as Internet Explorer, it doesn't have Internet Explorer's tight security restrictions.
In fact, if run with elevated privileges, HTAs have access to every resource that administrators have access to!
If you want to build a nice looking user interface for your VBScript scripts collection, try an HTA (or rewrite them in Visual Basic).
If you need to build a proof of concept for a new program, consider an HTA.
Microsoft's Visual Studio 2010 Express Edition installer is an example of a great looking HTA.
On this page, I intend to show some of the pitfalls I encountered in building HTAs, and some solutions or work-arounds.
My preferred tools for developing HTAs are VBSEdit and HTAEdit (they come bundled, 32-bit and 64-bit VBSEdit and HTAEdit all in a single package).
Both come with built-in debugger, but debugging an HTA is much harder then debugging VBScript code, so I usually write and test VBScript code in VBSEdit, and when ready, use it in an HTA's subroutines.
Each HTA is actually an HTML page with one or more HTA specific code blocks.
|<!DOCTYPE HTML>||Document Type Declaration||Optional but recommended for IE versions > 6|
|<html lang="en">||HTML begin||Language optional,
|<head>||HTML head begin||Required|
|<title>My HTML application</title>||HTML/HTA title bar caption||Optional but recommended, will also show up in Windows' task bar|
|<HTA:APPLICATION||HTA definition block begin||Required|
|APPLICATIONNAME="HTA Name"||HTA name||Required; can be read by script with
|ID="HTAID"||HTA unique ID||Required|
|VERSION="1.0"||HTA version||Required; can be read by script with
|SINGLEINSTANCE="yes"||Only one HTA with this HTA's ID can run at any time||If omitted or "no", multiple instances of this HTA can run simultaneously|
|WINDOWSTATE="maximize"||Maximize the HTA window when opened||Optional; not recommended if the HTA window must be resizable, as the window may resize spontaneously when dragged|
|/>||HTA definition block end|
|</head>||HTML head end||Required|
| 'This method will be called
'when the application loads
|page last uploaded: 2016-09-19, 14:58|