Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Scripting.FileSystemObject with VBScript in HTML page

Reply
 
Old 08-10-2009   #1 (permalink)
RaYlee


 
 

Scripting.FileSystemObject with VBScript in HTML page

Hi,

I am a newbie to VBScript and I am working on a web page which requires to
save some data
into directory folder. So I searched the web and found some source codes to
do it, however,
it seems the codes are not working at all.

I guess it may be guarded by the IE browser to prevent the code from
execution.

Does any expert tell me whether I should use this way to create folder and
file in file system
via html page? If possible, must I set anythings in IE browser to allow this
operation?

The source code:

<FORM NAME="Form1">
<TABLE BORDER=0 width=100%>
<TR>
<TD ALIGN="left">Click <a href="javascript:framePrint('content');">HERE</a>
to print the following contents online.</TD>
<TD ALIGN="right"><INPUT TYPE="Button" NAME="Button1" VALUE="Batch Print">
<SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
MsgBox "Test Starts"
Dim objFSO, objFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
MsgBox "FSO Created"
If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End If
MsgBox "Test Completed!"
</SCRIPT>
</TD>
</TR>
</TABLE>
</FORM>

Only "Test Starts" is shown and no "FsO Created" is displayed.

Thanks for your attention and help in advance,
Raymond



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4323 (20090810) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





My System SpecsSystem Spec
Old 08-10-2009   #2 (permalink)
ekkehard.horner


 
 

Re: Scripting.FileSystemObject with VBScript in HTML page

RaYlee schrieb:
Quote:

> Hi,
>
> I am a newbie to VBScript and I am working on a web page which requires to
> save some data
> into directory folder. So I searched the web and found some source codes to
> do it, however,
> it seems the codes are not working at all.
>
> I guess it may be guarded by the IE browser to prevent the code from
> execution.
>
> Does any expert tell me whether I should use this way to create folder and
> file in file system
> via html page? If possible, must I set anythings in IE browser to allow this
> operation?
>
> The source code:
>
> <FORM NAME="Form1">
> <TABLE BORDER=0 width=100%>
> <TR>
> <TD ALIGN="left">Click <a href="javascript:framePrint('content');">HERE</a>
> to print the following contents online.</TD>
> <TD ALIGN="right"><INPUT TYPE="Button" NAME="Button1" VALUE="Batch Print">
> <SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">
> MsgBox "Test Starts"
> Dim objFSO, objFolder
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> MsgBox "FSO Created"
> If objFSO.FolderExists(strDirectory) Then
> Set objFolder = objFSO.GetFolder(strDirectory)
> Else
> Set objFolder = objFSO.CreateFolder(strDirectory)
> End If
> MsgBox "Test Completed!"
> </SCRIPT>
> </TD>
> </TR>
> </TABLE>
> </FORM>
>
> Only "Test Starts" is shown and no "FsO Created" is displayed.
>
> Thanks for your attention and help in advance,
> Raymond
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 4323 (20090810) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
use a .hta file instead of a .thml file. Avoid to lower the security level
of IE.

My System SpecsSystem Spec
Old 08-10-2009   #3 (permalink)
mr_unreliable


 
 

Re: Scripting.FileSystemObject with VBScript in HTML page

RaYlee wrote:
Quote:

> I am a newbie to VBScript and I am working on a web page which requires to
> save some data into directory folder. So I searched the web and found some
> source codes to do it, however, it seems the codes are not working at all.
>
> I guess it may be guarded by the IE browser to prevent the code from
> execution.
>
hi RaYlee, did you understand Ekkehardt's response? It was timely,
but a little brief.

I think what he intended to say was that you couldn't use the "fso"
object in browser (IE) code. That is because with fso you can change
and/or delete stuff on somebody's system. And if that were ever
allowed then any web page could potentially cause is serious damage...

What he suggested was to use an "HTA" application -- which is a web
page with an "HTA" extension instead of an "HTM" extension (plus an
hta tag). An HTA miniapp is not subject to the same security
restrictions as an HTM page.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)

My System SpecsSystem Spec
Old 08-10-2009   #4 (permalink)
Tim Williams


 
 

Re: Scripting.FileSystemObject with VBScript in HTML page

Should add that HTA is *not* a viable solution unless this is an intranet
project. You'd have to be crazy to open an HTA from an internet location.
The usual way to do this would be to have the server send the data with the
appropriate headers, and have the end-user decide what to do with it
(open/save).

Tim

"mr_unreliable" <kindlyReplyToNewsgroup@xxxxxx> wrote in message
news:uLRhW$dGKHA.4316@xxxxxx
Quote:

> RaYlee wrote:
Quote:

>> I am a newbie to VBScript and I am working on a web page which requires
>> to save some data into directory folder. So I searched the web and found
>> some
>> source codes to do it, however, it seems the codes are not working at
>> all.
>>
>> I guess it may be guarded by the IE browser to prevent the code from
>> execution.
>>
>
> hi RaYlee, did you understand Ekkehardt's response? It was timely,
> but a little brief.
>
> I think what he intended to say was that you couldn't use the "fso"
> object in browser (IE) code. That is because with fso you can change
> and/or delete stuff on somebody's system. And if that were ever
> allowed then any web page could potentially cause is serious damage...
>
> What he suggested was to use an "HTA" application -- which is a web
> page with an "HTA" extension instead of an "HTM" extension (plus an
> hta tag). An HTA miniapp is not subject to the same security
> restrictions as an HTM page.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
> the answers will be applicable to the questions)
>

My System SpecsSystem Spec
Old 08-11-2009   #5 (permalink)
mayayana


 
 

Re: Scripting.FileSystemObject with VBScript in HTML page

Quote:

> Should add that HTA is *not* a viable solution unless this is an intranet
> project. You'd have to be crazy to open an HTA from an internet location.
> The usual way to do this would be to have the server send the data with
the
Quote:

> appropriate headers, and have the end-user decide what to do with it
> (open/save).
It's designed not to work remotely at all. That's
the one restriction. A person who clicks a link
should not even be given a choice about opening
the page. They just get a "where do you want to
put it?" window. In fact, I sometimes get that even
when it's local. I don't remember why. Maybe it was
a case where I ran the HTA through other code? I'm
not sure.


My System SpecsSystem Spec
Old 08-11-2009   #6 (permalink)
mr_unreliable


 
 

Re: Scripting.FileSystemObject with VBScript in HTML page

RaYlee wrote:
Quote:

> I am a newbie to VBScript and I am working on a web page which requires to
> save some data into directory folder.
hi RaYlee,

Here is another approach you might consider. Use an "installer".

There are all sorts of installers out there, many are free.
Most likely you will already have microsoft's own installer
(called "msi") installed on your system. Microsoft uses its
installer to upgrade your system.

An installer will do almost anything you can imagine.
For example, you can create sub-directories (er, folders)
and stuff data into those newly-created folders.

The usual webpage treatment for installer downloads would
be to post some instructions to the user, such as: "if you
want me to install this new data on your system, download
this file to your desktop and click on it... ".

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Scripting HTML from server VB Script
Scripting BitLocker in vbScript VB Script
Re: HTML and ASP scripting. VB Script
HTML and VBscript printer management page VB Script
working on html objects using HTML DOM, VBscript VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46