问题
I'm a good scripter, but not a developer. Can someone please advise how to force a click event to this line of code, or to force the "installergui_startinstallation" routine to kick off automatically. Thanks. Here is the line that takes the click command:
<button id=butStartInstallation onClick="InstallerGUI_startInstallation">Install</button>
<button id=butCancel onClick="self.close()">Cancel</button>
回答1:
So I am a Javascript man, and it looks like in HTA you can have a <script type="text/javascript">
so if that is the case then have a shot at this
<button id="butStartInstallation" onClick="InstallerGUI_startInstallation">Install</button>
<button id="butCancel" onClick="self.close()">Cancel</button>
<script type="text/javascript">
function doClick() {
document.getElementById("butStartInstallation").click();
}
doClick();
</script>
If that isn't enough HERE is another resource for you to check out. They use Javascript in that example
If you are using VBScript then HERE is another example for you to check out
来源:https://stackoverflow.com/questions/40030955/i-need-to-force-a-click-within-a-hta-script