I've been searching for a solution to an issue of wrapping an .hta file into an .exe so users can just click and go. The application I'm working on is a collection of batch scripts which are loaded from the GUI via .hta. I've tried various googled solutions including HTAEdit. All seem to not correctly create the .exe or appear easy targets for a new local infection.
HTAEdit which seems the most legitimate solution worked once and then continually fails, so my questions are as follows:
- Assuming the below code is correct is there a tool out there that actually converts HTA to EXE?
- While the below code is somewhat long, being new to programming in general I'm unsure if I messed something up?
(The below code works in the HTAEditor but every-time I try to convert it, it fails to complete conversion.)
Thank you for your time, and sorry is this post is to similar to the one I linked above, there are no further solutions I was able to find either on Stack or Google.
<html>
<title>Foo</title>
<HTA:APPLICATION
ID="Foo"
APPLICATIONNAME="Foo"
BORDERSTYLE="raised"
ICON="Logos/icon.ico"
SINGLEINSTANCE="yes"
>
<SCRIPT LANGUAGE="VBScript">
Sub Window_onLoad
window.resizeTo 800,400
End Sub
Sub SubChooseScript
For Each Button In SecureOption
If Button.Checked Then
If Button.Value = "Category" Then
For Each objButton in RadioOption
If objButton.Checked Then
Select Case objButton.Value
Case "Selection One"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case "Selection Two"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case "Selection Three"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case Else
MsgBox "Something bad happened. Please try again"
self.close()
End Select
End If
Next
End If
End If
If Button.Checked Then
If Button.Value = "Category Two" Then
For Each objButton in RadioOption
If objButton.Checked Then
Select Case objButton.Value
Case "Selection One"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case "Selection Two"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case "Selection Three"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Scripts\foo.bat"
self.close()
Case Else
MsgBox "Something bad happened. Please try again"
self.close()
End Select
End If
Next
End If
End if
Next
End Sub
</SCRIPT>
<body>
<img src="Logos\logo.jpg" align="right" height="200" width="200"/>
<p><b>Radio Options One</b></p>
<div class="button-formatting">
<input type="radio" name="RadioOption" value="foo" id="foo"><b> <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="RadioOption" value="foo" id="foo"><b> <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="RadioOption" value="foo" id="foo"><b> <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><P>
<p><b>Radio Options Two</b></p>
<input type="radio" name="foo" value="foo" id="foo"><b><u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
<input type="radio" name="foo" value="foo" id="foo"><b> <u>foo</u></b>
<label for="foo", style="font: 16px Arial"><i>-- bar.</i></label><BR>
</div><BR>
<input id=runbutton class="button" type="button" value="Options" name="run_button" onClick="SubChooseScript">
</body>