Inside the Script Element
The script element in VBScriptUI.hta identifies VBScript as the scripting language and contains seven subroutines. The subroutines are where the real work of the application occurs. The HTA input box is mainly a way for you to acquire user input and for the user to select one or more processes to perform. You'll generally have a subroutine for each button in your HTA input box. I won't go into the details of each subroutine here, but a few subroutines warrant some explanation:
The Window_Onload subroutine, which Listing 2 shows, executes when the HTA opens. This is a good place to do upfront work that doesn't require user interaction.
The RadioButtons subroutine, which Listing 3 shows, evaluates whether a radio button is selected. You use the Checked property of the object. You also need to indicate which button you're evaluating. For example, to check the first radio button, you'd use the following code:
If RadioButton(0) _.Checked Then ...
As you can see, radio buttons are structured as an array. Note that the first element number is 0. . . .
maprocks March 15, 2006 (Article Rating: