Scripting.FileSystemObject with VBScript in HTML page


  1.    10 Aug 2009 #1
    RaYlee Guest

    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

  2.    10 Aug 2009 #2
    ekkehard.horner Guest

    Re: Scripting.FileSystemObject with VBScript in HTML page


    RaYlee schrieb:

    > 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

  3.    10 Aug 2009 #3
    mr_unreliable Guest

    Re: Scripting.FileSystemObject with VBScript in HTML page


    RaYlee wrote:

    > 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

  4.    10 Aug 2009 #4
    Tim Williams Guest

    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

    > RaYlee wrote:

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

  5.    11 Aug 2009 #5
    mayayana Guest

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

  6.    11 Aug 2009 #6
    mr_unreliable Guest

    Re: Scripting.FileSystemObject with VBScript in HTML page


    RaYlee wrote:

    > 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

Scripting.FileSystemObject with VBScript in HTML page

Similar Threads
Thread Forum
problem download HTML in VBScript
'//*********************** '// Test of downloading HTML DOM object '// Gets title OK as shown '// Does not get title if WScript.echo is commented...
VB Script
Scripting HTML from server
I wrote a VBscript program and put it in a .vbs file. I put that file on the server and double click. It opens MS Word, no problems. I created a...
VB Script
Some solutions I have constructed (HTA HTML vbScript)
<!-- Hi Below is a HTA Doc, which is under construction. Anyhow, I think I have found some nice solutions, I would like to share. E.x.: ...
VB Script
Scripting BitLocker in vbScript
Hi, I have decided to rename this thread in the hopes that someone can help me out here. The problem with the script below is that it returns...
VB Script
Re: HTML and ASP scripting.
FYI: this would have been more on-topic in one of the inetserver groups. Your result means that your page is not being processed by asp.dll. A...
VB Script
HTML and VBscript printer management page
Hi, I trying to create a HTM printer management page that adds or removes printers via VBscripting and downloaded some code but doesn't seems to...
VB Script
working on html objects using HTML DOM, VBscript
Hi All, I have one html page with forms and objects like radiobuttons, checkboxes, dropdown list, text boxes, links..... I will perform some...
VB Script

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 07:39.
    .