Paul
Mon Jan 29 17:08:42 CST 2007
"E C H (He of too much code)" <glasswalkertheurge@juno.com> wrote in message
news:e6vMHG%23QHHA.1908@TK2MSFTNGP05.phx.gbl...
> Not trying to create a HTA to monitor status of servers. I have a
> VBScript that does this, but I would love to offer it in a more
> configurable/graphical options. The only way I am going to learn HTA is
> by making one.
Learn by using HTA Helpomatic, free download from Microsoft. Link here:
http://blogs.technet.com/tonyso/archive/2005/10/21/412817.aspx
When you run the HTA, you can click on a list of about 30 topics, and it
produces 1) HTML to implement that topic, 2) a description of the topic or
HTML, and for many topics, 3) in some cases, such as for a button's
on-click event, the Script code for a function that executes when the event
fires, and often, 4) an implementation of the HTML and script, so for
example, you can actually see the button produced by the HTML and the
tooltip displayed by the script when you hover the mouse over the button.
For example, for the "Create basic HTA" topic, this HTML is displayed:
<html>
<head>
<title>HTA Helpomatic</title>
<HTA:APPLICATION
ID="objHTAHelpomatic"
APPLICATIONNAME="HTAHelpomatic"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>
<SCRIPT Language="VBScript">
</SCRIPT>
<body>
</body>
</html>
And this description tells you how to use it:
Sample code that creates the basic structure of an HTA; to use this, copy
the code, paste it into Notepad, and then save the file with a .hta file
extension. You can then place HTML elements (such as buttons and listboxes)
inside the body tag, and place scripts that you write inside the script tag.
Note: Be sure your scripts have unique names within each HTA, and that they
start with the Sub tag (for example, Sub RunScript) and end with the End Sub
tag.
Run the HTA and spend 20 minutes looking at what you get with each of the
topics and you will be amazed at your expertise.
The guts of HTA Scriptomatic is a set of If D1.Value="The Topic" Then ...
End If blocks, one for each of the topics. These IF blocks create four
strings, strScript, strSub, strExample, strDescription
The following five lines display the stings and where applicable, set up to
display the strings in action:
ConfigureArea.Value = strScript
SubroutineArea.Value = strSub
SampleArea.InnerHTML = strExample
Description.InnerHTML = strDescription
ExampleScript.Text = SubroutineArea.Value
Spend another 20 minutes studying the If D1...End If blocks and the five
lines above, and you will be an HTA expert!
-Paul Randall