Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Error: Object required: 'WScript'

Status
Not open for further replies.

karmafree

Programmer
May 10, 2001
107
GB
Hey,

I've got this file called backup1.html on my desktop which contains a script that will make a copy of itself and make a new file called backup2.html I can't get it working! I get the following error:

Line: 13
Char: 2
Error: Object required: 'WScript'
Code: 0
URL: file://C:\Windows\Desktop\backup1.html

Here's the code:

<html>

<title>backup1.html</title>

<script language=&quot;vbscript&quot;>
<!--

Sub doBackUp()
Dim fso, f, contents

Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)

Set f = fso_OpenTextFile(WScript.ScriptFullName, 1)
contents = f.ReadAll ^ thats the error, why!

Set f = fso.CreateTextFile(&quot;backup2.html&quot;, True)
f.WriteLine(contents)
f.Close
End Sub

-->
</script>

<body onLoad=&quot;doBackUp()&quot;>

</body>
</html>

Thanks,
karmafree.
 
Any other way to make a copy of the current HTML file open using a script?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top