Link to home
Start Free TrialLog in
Avatar of begarrison
begarrison

asked on

HTA Application Desktop

I am trying to write my first HTA application.  

I want it to do a very simple task, open the window and have a close/exit button.
When the user click the button, it writes the word "FINISHED" to a local text file on the
hard drive and close the program.   I know this is very simple, but I have never written a HTA application before.


<html> 
<head> 
<title>Modal Example</title>
<HTA:APPLICATION
     Sysmenu="no" 
     APPLICATIONNAME="MainModal">
</head>
 
<script language="VBScript"> 
 
Sub ExitProgram
  Dim fso
  Set fso = CreateObject("scripting.filesystemobject")
  Dim txtFile as String
  Dim txtstr as TextStream
  txtFile = "C:\TheAutomoator\HotFile.txt"
  Set txtstr = fso.CreateTextFile(txtFile,True)
  txtstr.writeline "Finished"
  txtstr.Close
  window.close()
End Sub
</script> 
<body> 
<input id=runbutton type="button" Value="Exit when Finished" onClick="ExitProgram">
</body> 
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of astroviper
astroviper

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of begarrison
begarrison

ASKER

The response was very helpful and solved the problem.  I have been a member for some time and finally used the service.  i know why I joined.
Thanks.