![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 > of IE. |
My System Specs![]() |
| | #3 (permalink) |
| | 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. > 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| | #5 (permalink) |
| | 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 Quote: > appropriate headers, and have the end-user decide what to do with it > (open/save). 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 Specs![]() |
| | #6 (permalink) |
| | 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. 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 Specs![]() |
![]() |
| 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 | |||