Like VulcanJedi I'm not sure what your wanting. With HTA's subroutines provide the control you're wanting automatically. If your just imputing data and you're not validating the data then you tab to the next field and the HTA will simply for you to input data. Using specific subroutines you can perform routines when you enter the field or exit the field and you can change what field has focus by telling the HTA what field or button has the focus. Pushing a button is intended for some sort of action after you have entered all of your data but the button will not execute the onClick sub associated with the button name until you press the button. Here's a sample HTA that may help you understand how things work in an HTA. The HTA below allows you to input data into textbox fields and when the data is entered it writes the data to a text file and then displays the users external IP address if they are behind a router. If the data file exists the next time the HTA is executed it will read the file and load the previously stored data into the HTA fields and skip all input and place focus on the start button. There's also an simple encryption routine and some other cool stuff as a demo of what you can do with an HTA. Hope this helps you. Enjoy!
<HEAD>
<TITLE>Track My External IP Address</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<FORM NAME="TrackMyIPForm">
<HTA:APPLICATION
ID = "TrackMyIP"
APPLICATIONNAME = "Track My External IP Address"
BORDER = "thick"
CAPTION = "yes"
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
SYSMENU = "yes"
WINDOWSTATE = "Normal"
SCROLL = "No"
SCROLLFLAT = "No"
VERSION = "1.0"
INNERBORDER = "yes"
SELECTION = "no"
MAXIMIZEBUTTON = "Yes"
MINIMIZEBUTTON = "Yes"
NAVIGABLE = "yes"
CONTEXTMENU = "yes"
BORDERSTYLE = "sunken"
>
<center><Table Border =2>
<Caption><Font color="#0000FF" face="arial" size="4pt"><B>Track My External IP Address</Font></B></Caption>
<Caption><Font color="#0000FF" face="arial" size="1pt"><B>Please make appropriate changes before pressing <U>START</U></Font></B>
<Caption><Font color="#0000FF" face="arial" size="1pt"><B>Note: Passwords are hidden and encrypted.</Font></B>
<TR><Center>
<TD><Font face="arial" size="2pt">Sender First Name:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" SIZE=30 NAME="SenderFirstName"></TD>
</Center></TR>
<TR>
<TD><Font face="arial" size="2pt">Sender Last Name:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" SIZE=30 NAME="SenderLastName"></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">Send From Address:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" SIZE=30 NAME="SendFromAddr"></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">Send To Address:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" SIZE=30 NAME="SendToAddr"></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">SMTP Server:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" Size=30 Name="SMTPServer"></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">Sender User Name:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="TEXT" Size=30 Name="SendUserName"></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">Sender User PSWD:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="PASSWORD" ID="PSWD1" SIZE=30 NAME = "SendUserPSWD1"></Font></TD>
</TR>
<TR>
<TD><Font face="arial" size="2pt">Confirm User PSWD:</TD>
<TD><Font face="arial" size="2pt"><INPUT TYPE="PASSWORD" ID="PSWD2" SIZE=30 NAME = "SendUserPSWD2"></Font></TD>
</TR>
<TR>
</Table></Center>
<FONT <Font color="#FF3333" size="1pt"><BR><B><Center><DIV ID=divProgress STYLE="font-size:30">...</B></DIV></Font></CENTER>
<P><Font face="arial" size="2pt"><Center><INPUT TYPE="BUTTON" SIZE=50 NAME="Execute" VALUE="Start" > <INPUT TYPE="BUTTON" SIZE=50 NAME="Terminate" VALUE="Stop" ></Font></CENTER>
</FORM>
</BODY>
</HTML>
<SCRIPT LANGUAGE="VBSCRIPT">
<!-- Option Explicit
'************************************************************************************
'* TrackMyIP.HTA *
'************************************************************************************
'* *
'* This is a sample HTA with embedded VBScript code. The intent is to show how an *
'* HTA can be coded with some input boxes and push buttons and a display area. *
'* *
'************************************************************************************
Dim fso,wshShell,OutputFileName,ExternalIPAddress,HeldExternalIP,CurrentPath,idTimer,_
VBScriptFileName
'************************************************************************************
'* This subroutine is executed when the HTA Windows is first opened. For the most *
'* part this is program initialization stuff. *
'************************************************************************************
Sub window_OnLoad()
Dim form
Set form = document.TrackMyIPForm
ScreenHeight = screen.availHeight
ScreenWidth = screen.availWidth
WindowWidth = 420
WindowHeight = 520
WindowLeft = (ScreenWidth-WindowWidth)*.5
WindowTop = (ScreenHeight-WindowHeight)*.25
window.resizeto WindowWidth,WindowHeight
window.moveTo WindowLeft, WindowTop
form.SenderFirstName.value = ""
form.SenderLastName.value = ""
form.SendFromAddr.value = ""
form.SendToAddr.value = ""
form.SMTPServer.value = ""
form.SendUserName.value = ""
form.SendUserPSWD1.value = ""
form.SendUserPSWD2.value = ""
Set Fso = CreateObject("Scripting.FileSystemObject")
ExternalIPAddress = ""
HeldExternalIP = ""
CurrentPath = Fso.GetAbsolutePathName(".")
OutputFileName = CurrentPath & "\TrackMyIP.txt"
Call GetEmailInfo
If form.SendUserPswd1.value <> "" then
document.getElementByID("PSWD2").disabled = True
End If
if form.SenderFirstName.value = "" then
form.SenderFirstName.focus
else
form.Execute.focus
end if
End Sub
'************************************************************************************
'* This subroutine handles the encryption of any new password in the Password1 *
'* and changes the status of the Password2 field which is normally disabled. *
'************************************************************************************
sub SendUserPSWD1_OnChange()
Dim form
Set form = document.TrackMyIPForm
form.SendUserPSWD1.value = EnDeCrypt(form.SendUserPSWD1.value)
document.getElementByID("PSWD2").disabled = False
form.SendUserPSWD2.value = ""
form.SendUserPSWD2.focus
end sub
'************************************************************************************
'* This subroutine handles the encryption of any new password in the Password2 *
'* field handles the status of the Password2 field which is normally disabled. This *
'* subroutine also handles the situation where the two passwords don't match since *
'* the end user cannot see the password in clear text. *
'************************************************************************************
sub SendUserPSWD2_OnChange()
Dim form
Set form = document.TrackMyIPForm
form.SendUserPSWD2.value = EnDeCrypt(form.SendUserPSWD2.value)
if form.SendUserPSWD1.value <> form.SendUserPSWD2.value then
MsgBox "Passwords do not match. Plese re-enter both passwords"
form.SendUserPSWD1.value = ""
form.SendUserPSWD2.value = ""
form.SendUserPSWD1.focus
else
document.getElementByID("PSWD2").disabled = True
form.Execute.focus
end if
end sub
'************************************************************************************
'* This subroutine handles the events that take place when the end user presses the *
'* Execute button. In this subroutine the external file is written out. *
'************************************************************************************
Sub Execute_OnClick()
Dim form,Fso,oStream,WshShell,InputLine,InputArray,KeyWord,Command
set form = document.TrackMyIPForm
Set Fso = CreateObject("Scripting.FileSystemObject")
Set oStream = Fso.CreateTextfile(OutputFileName)
Set WshShell = CreateObject("WScript.Shell")
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
strSystemRoot = wshShell.ExpandEnvironmentStrings( "%SYSTEMROOT%" )
Call GetExternalIP
oStream.WriteLine "SenderFirstName:" & form.SenderFirstName.value
oStream.WriteLine "SenderLastName:" & form.SenderLastName.value
oStream.WriteLine "SendFromAddr:" & form.SendFromAddr.value
oStream.WriteLine "SendToAddr:" & form.SendToAddr.value
oStream.WriteLine "SMTPServer:" & form.SMTPServer.value
oStream.WriteLine "SendUserName:" & form.SendUserName.value
oStream.WriteLine "SendUserPSWD1:" & form.SendUserPSWD1.value
oStream.WriteLine "SendUserPSWD2:" & form.SendUserPSWD2.value
oStream.writeLine "ExternalIPAddress:" & ExternalIPAddress
ostream.close
End Sub
'************************************************************************************
'* This subroutine handles the events that take place when the end user presses the *
'* Stop button. In this subroutine simply closes the hypertext application. *
'************************************************************************************
Sub Terminate_OnClick()
self.close
End Sub
'************************************************************************************
'* Once the external email info is written to the TrackMyIP.txt file the first time *
'* it is re-used the next time the program is used and this get the old info. *
'************************************************************************************
Sub GetEmailInfo()
Dim form,Fso,oStream,InputLine,InputArray,KeyWord
set form = document.TrackMyIPForm
Set Fso = CreateObject("Scripting.FileSystemObject")
If Fso.FileExists(OutputFileName) Then
Set ostream = Fs

penTextFile(OutputFileName)
Do While not(ostream.atEndOfStream)
InputLine = ostream.ReadLine
if instr(inputline,":") then
InputArray = Split(InputLine,":")
Keyword = InputArray(0)
Select Case KeyWord
Case "SenderFirstName"
form.SenderFirstName.value = InputArray(1)
Case "SenderLastName"
form.SenderLastName.value = InputArray(1)
Case "SendFromAddr"
form.SendFromAddr.value = InputArray(1)
Case "SendToAddr"
form.SendToAddr.value = InputArray(1)
Case "SMTPServer"
form.SMTPServer.value = InputArray(1)
Case "SendUserName"
form.SendUserName.value = InputArray(1)
Case "SendUserPSWD1"
form.SendUserPSWD1.value = InputArray(1)
Case "SendUserPSWD2"
form.SendUserPSWD2.value = InputArray(1)
Case "ExternalIPAddress"
Case Else
End Select
End If
Loop
ostream.close
End If
End Sub
'************************************************************************************
'* This subroutine goes out to the Internet and grabs the external IP address that *
'* is assigned to this computer. *
'************************************************************************************
Sub GetExternalIP()
Dim objIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "
' or "
objIE.Visible = False
Do While objIE.Busy
idTimer = window.setTimeout("PausedSection", 1000, "VBScript")
Loop
ExternalIPAddress = objIE.Document.body.innerhtml
ExternalIPAddress = Trim(Mid(ExternalIPAddress,inStr(ExternalIPAddress,":") + 2))
divProgress.InnerText = ExternalIPAddress
Set objIE = Nothing
End Sub
'************************************************************************************
'* HTA's don't have a SLEEP function capability so a Timer is needed to control *
'* the wait function. Each time the time is set it must be cleared *
'************************************************************************************
Sub PausedSection
window.clearTimeout(idTimer)
End Sub
'************************************************************************************
'* Encrypts/decrypts the SendUserPSWD value so then when the TrackMyIP.TXT file is *
'* saved the information is not shown in clear text. *
'************************************************************************************
Function EnDeCrypt(plaintxt)
Dim sbox(255), key(255), a, b, h, i, j, k, cipherby, cipher, temp, tempswap, intLength, psw
i = 0
j = 0
psw = "LswPPlKXQJ"
intLength = Len(psw)
For a = 0 To 255
key(a) = Asc(Mid(psw, (a Mod intLength) + 1, 1))
sbox(a) = a
Next
b = 0
For a = 0 To 255
b = (b + sbox(a) + key(a)) Mod 256
tempswap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempswap
Next
For h = 1 To Len(plaintxt)
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp
k = sbox((sbox(i) + sbox(j)) Mod 256)
cipherby = Asc(Mid(plaintxt, h, 1)) Xor k
cipher = cipher & Chr(cipherby)
Next
EnDeCrypt = cipher
End Function
-->
</SCRIPT>
</BODY>
</HTML>