Hello,

The following script is giving me this error:

Object required: {string: '["""D:\Program Files\Ju"]'

I've tried %20 and that did not work. What changes need to be made to
the VBScrit below to get rid of the above error.

Dim regedit, nFile
set regedit = CreateObject("WScript.Shell")
set nFile = """D:\Program Files\Just BASIC v1.01\My Programs
\eBookErrFix\eBookErrFix\eBookErrFix\CurrentFile.txt"""
nFile.write(regedit.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft
\Windows NT\CurrentVersion\Winlogon\DefaultUserName"))

Thank you for your help,
jfcby

Re: VBScript Error by jamesfc30

jamesfc30
Tue Mar 11 20:49:02 CDT 2008

Hello,

I put this in the wrong news group. I'll repost it the correct news
group.

jfcby

Re: VBScript Error by David

David
Tue Mar 11 22:28:50 CDT 2008

On Mar 11, 6:40=A0pm, jamesf...@gmail.com wrote:
> Hello,
>
> The following script is giving me this error:
>
> Object required: {string: '["""D:\Program Files\Ju"]'
>
> I've tried %20 and that did not work. What changes need to be made to
> the VBScrit below to get rid of the above error.
>
> Dim regedit, nFile
> =A0set regedit =3D CreateObject("WScript.Shell")
> =A0set nFile =3D """D:\Program Files\Just BASIC v1.01\My Programs
> \eBookErrFix\eBookErrFix\eBookErrFix\CurrentFile.txt"""
> =A0nFile.write(regedit.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft
> \Windows NT\CurrentVersion\Winlogon\DefaultUserName"))
>
> Thank you for your help,
> jfcby


%20 has nothing to do with it. While %20 is an escape sequence for the
space character in an URL, it is not recognized as the escape sequence
for the space character for a Filename on the filesystem.

A string does not have a method called "write" -- hence the error is
"Object required".

You need to open a file handle to "CurrentFile.txt" to be able to do
what you are doing.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//