I have written a HTA for some task to be done. I have used CSS within it. The issue is that the page is a bit distorted (layout is not proper, buttons are misplaced), and requires a refresh/reload to have it in proper format. Hence I wanted a workaround to have the HTA to reload just ONCE after opening.
I tried writing various codes in Window_onLoad
to reload the window, but it causes the window to reload infinitely (since after every reload Window_onLoad
gets fired). Hence required something which could reload just once and automatically, that too as soon as window is loaded, since I don't want to keep the users waiting to have a proper view of application.
Below is the code :
body
{
margin: 0;
padding: 0;
background-color: #000;
font-family: 'lucida grande', arial, tahoma, sans-serif;
}
#container
{
margin: 0 auto;
padding-top:0;
width: 100%;
position: static;
background-color: #222;
}
#header
{
margin: 0 auto;
width: 100%;
height: 800px;
background: transparent url('p1.jpg');
background-size: 50% 50%;
}
.headtitle
{
position: relative;
font-family: Times;
font-size: 40px;
color: #FFF;
top: 20px;
left: 18px;
}
form {
padding: 20px 0;
position: relative;
top: 80px;
margin: 0 auto 10px 300px;
}
form input {
outline: 0;
border: 0px
background-color: rgba(255, 255, 255, 0.2);
width: 200px;
border-radius: 15px;
padding: 1px 15px;
margin: 0 auto 10px auto;
display: block;
text-align: center;
font-size: 18px;
color: black;
-webkit-transition-duration: 0.25s;
transition-duration: 0.25s;
behavior: url(PIE.htc);
font-size: 90%;
}
form input:hover {
background-color: rgba(255, 255, 255, 0.4);
}
form input:focus {
background-color: white;
width: 300px;
color: #53e3a6;
}
<html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Simple HTA"
BORDER="NONE"
MaximizeButton="no"
Scroll="NO"
SYSMENU="YES">
<title>PrOtOtYpE</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script language="VBScript">
SUB RunFile
SET WshShell = CreateObject("WScript.Shell")
WshShell.Run "Z:/SSH/SshClient.exe"
End SUB
SUB CloseWindow
self.close
End SUB
SUB Window_onLoad
window.resizeTo 800,700
End SUB
</script>
</head>
<body>
<div id="container">
<div id="header">
<div class="headtitle">PrOtOtYpE</div>
<form class="form" name="form">
<input type="button" name="button" value="App Web Server 505" onclick="RunFile"/>
<input type="button" name="but" value="App Web Server 506" onclick="RunFile"/>
<input type="button" name="but" value="DB Server 178" onclick="RunFile"/>
<input type="button" name="but" value="DB Server 177" onclick="RunFile"/>
<input type="button" name="but" value="Close" onclick="CloseWindow"/>
</form>
</div>
</div>
</body>
</html>