How hta Changed the Way I Deliver Builds - Part 2 - Defining a hta File

Well, if you read the first part and the wiki link you'll see that hta files are a mix of html and vbscript. The reason I started to go down this path is that I wanted a way I could have a build delivered without the problem of people having to know vba or similar. It's a fairly easy thing for someone to pick up the html and vbscript lines in a hta to edit and build on.

The hta I'll be using as a base for the first part of this is available in this thread.

spsi_cad.txt can be downloaded and renamed to spsi_cad.hta. If you try to run the hta, accept the errors as the file will be looking for network areas that will not exist on your machine. Don't stress, we'll go through these later.

The first section to be careful of are the lines that define that this is a hta application and how it will behave, including size. This can be found under:

<SCRIPT language="VBScript">
// This prevents resizeto from flashing on HTA invoke
// This must be done before the hta tag
window.resizeto 310,380
</SCRIPT>
<META HTTP-EQUIV="Expires" CONTENT="0">

<title>SPSi CAD Explorer</title>
<HTA:APPLICATION 
ID="GDFT2"
APPLICATIONNAME="cad_accessv03"
border="thin"
caption="yes"
MaximizeButton"yes"
MinimizeButton"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
sysmenu="no"
/>

This section also contains our first bit of vbscript. Notice that all sections of vbscript start with <SCRIPT language="VBScript"> and finish with </SCRIPT>. this is just telling the hta that vbscript is coming up and it is to be processed accordingly.

The function ' window.resizeto 310,380' sets the size the hta file will open as. Remember that this is just html and what you are effectively doing is opening a copy of the html code and we don't want a massive iExplorer window so we use this to set the dialog size.

Under HTA:APPLICATION it is always a good idea to have a unique ID and APPLICATIONNAME in case you want to have multiple hta files running. Later on we'll go through some other examples of how hta files can be useful.

The next critical line to be aware of in this is 'sysmenu'. This is the name used for the 3 buttons that are located in the top right hand side of any Windows view. Minimise, expand and close. You can thurn these off by setting the 'sysmenu' to 'no'. I have found this handy as you don't want users to turn off your hta mid stream. you can still close it by using Alt+F4.

More soon.

Anonymous