Startup hta

There are more ways to use hta files than just with our CAD builds. One other way I use them is to start all my programs when starting Windows. Even at home this is a handy little tool. I have created a hta that sits in the Startup section in windows that starts Chrome, Notepad++, Mozilla and iTunes whenever I log into Windows. I also have a button on the hta to start Windows Explorer, but you could add anything you find useful.

The code is easy enough to edit to suit yourself:


<head>
<style type="text/css">
.th_center {
font-size:120%;font-family:arial;
text-align:center;
vertical-align:center;
}

.td_left {
font-size:100%;font-family:arial;
text-align:left;
vertical-align:center;
}
.td_center {
font-size:90%;font-family:arial;
text-align:center;
vertical-align:center;
}


</style>

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

<title>Bear's Loader</title>
<HTA:APPLICATION 
ID="GDFT2"
APPLICATIONNAME="bear_load"
border="thin"
caption="yes"
MaximizeButton"yes"
MinimizeButton"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
sysmenu="yes"
/>

</head>

<script language="VBScript">

Const OverwriteExisting = True
Const NORMAL_WINDOW = 1

Dim WshShell, oEnv, objWST, objMS

Set WshShell = CreateObject("WScript.Shell")
Set oEnv = WshShell.Environment("process")



Sub Window_onload



WshShell.run "C:\Users\Bear\AppData\Local\Google\Chrome\Application\chrome.exe"

WshShell.run """C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"""

WshShell.run """C:\Program Files (x86)\Notepad++\notepad++.exe""" 

WshShell.run """C:\Program Files (x86)\iTunes\iTunes.exe"""


End Sub

Sub Explorer
WshShell.run "%SystemRoot%\explorer.exe"
End Sub


</script>

Start

<table width="95%" HEIGHT="95%" border="0">
<p> </p>
<tr>
<td valign="middle" bgcolor="#b52026">
<div align="center">
<p> </p>
<p>
<input id=Explorerbutton type="button" value="Explorer" name="Explorer" style="width=60px" onclick="Explorer">


</p>


</div>
</tr>
</td>
</table>

<div align="left">

</div>
</body>


Note the extra """ required for paths with spaces. We'll revisit this again when setting up our MicroStation start paths.

Enjoy.