Attribute
|
Description
|
Values
|
APPLICATIONNAME
|
Sets the name of the HTA.
|
String value. thick = thick border with a size grip and sizing border.
|
BORDER
|
Sets the type of window border for the HTA.
|
This is the default for the BORDER attribute. To resize your window, you must specify this value. The other values for this attribute disable sizing. dialog = dialog window order. none = no border.thin = thin border with a caption.
|
BORDERSTYLE
|
Sets the style of the content border in the HTA window.
|
normal = normal border style. This is the default for the BORDERSTYLE attribute. raised = raised 3D border. static = 3D Maps to the Windows extended border. Normally used for windows that don’t allow user input. style values. sunken = sunken 3D border.
|
CAPTION
|
Boolean value that specifies whether the HTA displays a caption or title bar.
|
Default value of this attribute is yes. All HTA attributes that take Boolean values accept the values of yes, 1, or true for True, and no, 0, or false for False. The application title for an HTA won’t display unless this attribute is set to yes.
|
ID
|
Sets the identifier for the <HTA:APPLICATION> tag. The identifier is needed to write script to access the attributes of the HTA.
|
String value.
|
ICON
|
Sets the path name of the icon that is used for the HTA. The icon appears in the upper-left corner of the HTA window. The icon for an HTA can be either an .ico or a .bmp file.
|
The path name of the icon.
|
MAXIMIZEBUTTON
|
Boolean value that determines whether a Maximize button is displayed in the title bar.
|
Default value is yes. The CAPTION attribute must be set to yes for the Maximize button to appear.
|
MINIMIZEBUTTON
|
Boolean value that determines whether a Minimize button is displayed in the title bar.
|
Default value is yes. The CAPTION attribute must be set to yes for the Minimize button to appear.
|
SHOWINTASKBAR
|
Boolean value that determines whether the HTA will appear in the Windows taskbar. This property does not affect whether the application appears in the list of applications that are accessible when pressing the Alt + Tab key combination.
|
Default value is yes.
|
SINGLEINSTANCE
|
Boolean value that determines whether only one instance of the HTA can be run at a time. The APPLICATIONNAMEattribute must be specified for this attribute to have any effect.
|
Default value is no, meaning that multiple instances of this particular HTA can be run concurrently.
|
SYSMENU
|
Boolean value that determines whether a system menu is displayed in the HTA title bar. The system menu is displayed when you click the icon in the upper-left corner of the HTA. This menu contains all the commands that appear in a Windows system menu for an application.
|
Default value is yes.
|
VERSION
|
Sets the version of the HTA. This version is for internal use only and is not interpreted in any way by the script engine or the document-rendering engine.
|
Default value is an empty string.
|
WINDOWSTATE
|
Sets the initial size of the HTA window.
|
normal = the HTA window will be the default size for an Internet Explorer window. Default value of this attribute. minimize = HTA window will be minimized when started. maximize = HTA window will be maximized when it’s launched.
|
Figure 6 Retreiving Attribute Values
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Sub btnShowAtts_onclick
Dim str
str = "ID: " & oHTA.ID & vbCrLf _
& "Application Name: " & oHTA.APPLICATIONNAME & vbCrLf _
& "Border: " & oHTA.BORDER & vbCrLf _
& "Border Style: " & oHTA.BORDERSTYLE & vbCrLf _
& "Caption: " & oHTA.CAPTION & vbCrLf _
& "Icon: " & oHTA.ICON & vbCrLf _
& "Maximize Button: " & oHTA.MAXIMIZEBUTTON & vbCrLf _
& "Minimize Button: " & oHTA.MINIMIZEBUTTON & vbCrLf _
& "Show in taskbar: " & oHTA.SHOWINTASKBAR & vbCrLf _
& "Single Instance: " & oHTA.SINGLEINSTANCE & vbCrLf _
& "System Menu: " & oHTA.SYSMENU & vbCrLf _
& "Version: " & oHTA.VERSION & vbCrLf _
& "Window State: " & oHTA.WINDOWSTATE
MsgBox str
End Sub
</SCRIPT>
Figure 7 Hello.hta
<HTML>
<HEAD>
<TITLE>Scripting the HTA:APPLICATION Tag</TITLE>
<HTA:APPLICATION
ID="oHTA"
>
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Dim cmdLineArray
Dim strHello
' This code assumes that you have no spaces in
' the path to Hello.hta. (In other words, this code
' splits the command line by spaces and assumes
' that your name is the second word.)
'
cmdLineArray = Split(oHTA.commandLine)
strHello = "Hello " & cmdLineArray(1) & ", " _
& "How are you?"
MsgBox strHello
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
Figure 9 MyBrowsr.hta
<HTML>
<HEAD>
<TITLE>MyBrowser</TITLE>
<HTA:APPLICATION
ID="oHTA"
ICON="MyBrowser.ico"
>
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Sub btnGo_onclick
Dim strAddr
strAddr = txtAddress.value
If InStr(1, strAddr, "://") = 0 Then
strAddr = "http://" & strAddr
End If
frmClient.document.location.href = strAddr
End Sub
Sub btnBack_onclick
frmClient.history.back
End Sub
Sub btnFwd_onclick
frmClient.history.forward
End Sub
</SCRIPT>
</HEAD>
<BODY scroll="no">
<B>Address:</B>
<INPUT TYPE="Text" ID="txtAddress">
<INPUT TYPE="Submit" ID="btnGo" VALUE="Go">
<BUTTON ID="btnBack" STYLE="position:relative;left:50px">
< Back</BUTTON>
<BUTTON ID="btnFwd" STYLE="position:relative;left:50px">
Forward ></BUTTON>
<P>
<IFRAME ID="frmClient"
TRUSTED="yes"
SRC="http://www.microsoft.com"
WIDTH="100%"
HEIGHT="90%"
>
</IFRAME>
</BODY>
</HTML>