在为VBscript使用HTA userform时,我发现HTA不支持WScript及其对象/方法。
有没有其他方法可以创建用户表单,或者有没有什么方法可以让HTA支持WScript?
发布于 2013-02-12 17:46:25
WScript.Echo的另一种选择是简单地向DOM添加内容:
<script language="vbscript">
dim div: set div = document.getElementById("output")
div.innerText = "output"
</script>
<div id="output"/>或者,如果你想要一个对话框,你可以使用MsgBox()
<script language="vbscript">
MsgBox "output"
</script>可以在没有WScript的情况下使用Scripting.FileSystemObject
<script language="vbscript">
dim fso: set fso = CreateObject("Scripting.FileSystemObject")
dim path: path = fso.GetAbsolutePathName(".")
'... etc
</script>发布于 2013-02-11 23:51:12
将您的Wscript代码放到.wsf-file中,并像这样调用脚本:
shell=new ActiveXObject('WScript.Shell');
shell.Exec('WScript //Job:job_id PATH_TO_YOUR_WSF_FILE');通过.wsf,您还可以使用WScript.Sleep()、WScript.SendKeys()等方法,这些方法在HTA中是不可用的。
欲了解更多信息,请访问:Windows Script Host
https://stackoverflow.com/questions/14813507
复制相似问题