代码错误800A01A8-必需的对象 [英] Code Error 800A01A8 - Object Required

查看:162
本文介绍了代码错误800A01A8-必需的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个打开文本框的HTA文件,允许用户输入文件夹的路径,然后将其保存到文本文件.

I have a HTA file that open a text box alows user to enter path to a folder then save it to a text file.

但是当我尝试使用第二个按钮运行批处理时,它给了我一个错误代码

But when I trying to use second button to run a batch, it gives me an error code

    <html>
<head>
<title>Files Sync </title>
<HTA:APPLICATION
  APPLICATIONNAME="Files Sync"
  ID="RY"
  VERSION="1.0"/>
</head>

<script language="vbscript">

Sub WriteTxt_OnClick()
    Dim fso, txt

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set txt = fso.CreateTextFile("\\fs-02\C$\ntfs3\scripts\MexSync\000.txt")

    txt.WriteLine document.Submitted_Link_To_Mex.body.value

    MsgBox "File Submitted",64,"Selection"


End Sub

Sub SYNC_onClick()

     Set WshShell = WScript.CreateObject("WScript.Shell")
     WshShell.Run "cmd.exe /c C:\work\RLTP_SYNC_MEX\RunChangePS1.bat", 0
            ' 0 => hide
     MsgBox("Success")

End Sub



</script>


<H2>Copy And Paste The Folder Path To Here </H2>
<body>


<form name="Submitted_Link_To_Mex">
<textarea name="body" cols="150" rows="20">

</textarea>
</form>




<br>
    <input type="button" value="1. SUBMIT" name="WriteTxt"> &nbsp; &nbsp; &nbsp;
    <input type="Button" value="2. SYNC" name="SYNC"> &nbsp; &nbsp; &nbsp;
    <input type="Button" value="3. CLOSE" name="button2" onClick="close" class="button">
</div>

</body>
</html>

我不知道为什么...虽然做了一些研究但是没有运气 有什么建议吗?

I can't find out why....did some research but no luck at all Any suggestion?

推荐答案

您的行中的WScript对象

The WScript object your line

Set WshShell = WScript.CreateObject("WScript.Shell")

HTA中不存在

要使用的尝试(由w | cscript.exe主机提供).由于VBScript(语言本身)提供了自己的CreateObject函数,因此只需使用

tries to use does not exist in a HTA (it is provided by the w|cscript.exe hosts). As VBScript (the language itself) provides its own CreateObject function, just use

Set WshShell = CreateObject("WScript.Shell")

这篇关于代码错误800A01A8-必需的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆