I am building an HTA/Batch script that includes an interface for a user to send an htareply to the batch script that will send a link to a server to execute a build script on Jenkins. Everything works great but I was wondering if I can leave the hta window open so the user can select another option if required. Any ideas?
I attempted to remove the window.close() from the javascript but then it does not send the htareply to the batch script.
<!-- :: Batch section
@echo off
setlocal
echo Select an option:
for /F "delims=" %%a in ('mshta.exe "%~F0"') do set "HTAreply=%%a"
echo End of HTA window, reply: "%HTAreply%"
PAUSE
goto :EOF
-->
<HTML>
<HEAD>
<HTA:APPLICATION SCROLL="no" SYSMENU="no" >
<TITLE>HTA Radio Buttons</TITLE>
<SCRIPT language="JavaScript">
window.resizeTo(440,170);
var reply = "No button selected";
function sendreply(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.GetStandardStream(1).WriteLine(reply);
//window.close();
}
</SCRIPT>
</HEAD>
<BODY>
<p>Select an option.</p>
<label><input type="radio" name="option1" onclick="reply=this.value"
value="option1">Option1</label>
<label><input type="radio" name="option2" onclick="reply=this.value"
value="option2">Option2</label>
<label><input type="radio" name="option3" onclick="reply=this.value"
value="option3">Option3</label>
<br><br>
<button onclick="sendreply()">Submit</button>
<button onclick="window.close()">Close</button>
</BODY>
</HTML>
What I would like to happen is if the user selects and option and submits, the hta window remains open until they select "close".