簡體   English   中英

代碼錯誤800A01A8-必需的對象

[英]Code Error 800A01A8 - Object Required

我有一個打開文本框的HTA文件,允許用戶輸入文件夾的路徑,然后將其保存到文本文件。

但是,當我嘗試使用第二個按鈕運行批處理時,它給了我一個錯誤代碼

代碼錯誤800A01A8-必需的對象:Wscript

    <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>

我不知道為什么。。。沒有做過任何研究,但是根本沒有運氣。有任何建議嗎?

WScript對象您的行

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

嘗試使用的內容在HTA中不存在(由w | cscript.exe主機提供)。 由於VBScript(語言本身)提供了自己的CreateObject函數,因此只需使用

Set WshShell = CreateObject("WScript.Shell")

您的替換文本上需要尾隨\\ ,否則您將擁有DataAppData

Replace(txt, "K:\", "D:\Data\")

另外response.write也適用於ASP ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM