How to include other VBS files
Author |
Message |
Osamu Tera #1 / 7
|
How to include other VBS files
For example if include sub01.vbs, sub02.vbs, sub03.vbs+ADs- +ACM- include file+AD0AIg-sub01.vbs+ACI- +ACM- include file+AD0AIg-sub01.vbs+ACI- +ACM- include file+AD0AIg-sub01.vbs+ACI- cause simply Err.. Could you let me know what's wrong above? Thanks in advance. ----------------------------------------- Osamu Terao Email: terasyu+AEA-gctv.ne.jp -----------------------------------------
|
Fri, 09 Jul 2004 18:03:12 GMT |
|
|
Alex Angelopoulo #2 / 7
|
How to include other VBS files
Is that the actual syntax you were using? I am not certain what your method is. Are you using ASP, straight HTML, or a VBScript file? For ASP, I'm not certain of the exact method. For incusion within HTML, you can include something like: <script src="./sub01.vbs"></script> For use with WSH, you have a couple of choices: (1) you can use a WSF with a <script src="..."> block similar to within HTML. (2) To evaluate from within VBScript, try the following: Set fso = CreateObject("Scripting.FileSystemObject") Const ForReading = 1, ForWriting = 2 Dim fso, f 'get Text file read in Set f = fso.OpenTextFile("sub01.vbs", ForReading) strInFileText = f.ReadAll execute strInFileText
Quote: > For example > if include sub01.vbs, sub02.vbs, sub03.vbs; > # include file="sub01.vbs" > # include file="sub01.vbs" > # include file="sub01.vbs" > cause simply Err.. > Could you let me know what's wrong above? > Thanks in advance. > ----------------------------------------- > Osamu Terao
> -----------------------------------------
|
Fri, 09 Jul 2004 19:53:15 GMT |
|
|
Alex Angelopoulo #3 / 7
|
How to include other VBS files
Sorry, Osamu. I replied before my first cup of coffee. It certainly does appear you are using ASP. here's how this should work. <!-- #include file="subx.vbs" --> ---------------------------------- <!-- Contents of subx.vbs --> <script language="vbscript"> <!-- MsgBox "This is a test!" --> </script> If this doesn't answer your question, try posting ALL of these: (a) exact error and line number (b) the file _containing_ your include statements (c) contents of the first _included_ file which causes the error Good luck.
Quote: > For example > if include sub01.vbs, sub02.vbs, sub03.vbs; > # include file="sub01.vbs" > # include file="sub01.vbs" > # include file="sub01.vbs" > cause simply Err.. > Could you let me know what's wrong above? > Thanks in advance. > ----------------------------------------- > Osamu Terao
> -----------------------------------------
|
Fri, 09 Jul 2004 20:29:21 GMT |
|
|
Philip Dearmor #4 / 7
|
How to include other VBS files
Also, it looks like you're trying to conditionally include vbs files. You can't do that. You either include them or don't. You might look at the server.execute method as a workaround, though. <!-- #include file="sub01.vbs" --> Would be the syntax. Philip
Quote: > For example > if include sub01.vbs, sub02.vbs, sub03.vbs; > # include file="sub01.vbs" > # include file="sub01.vbs" > # include file="sub01.vbs" > cause simply Err.. > Could you let me know what's wrong above? > Thanks in advance. > ----------------------------------------- > Osamu Terao
> -----------------------------------------
|
Fri, 09 Jul 2004 21:03:04 GMT |
|
|
Osamu Tera #5 / 7
|
How to include other VBS files
Thanks kind reply, Actually I'm trying to include VBS files from a parent VBS file. So far I have been played by, or fighting with, ASP, simply thought the same way might work. Then that caused Err, so asked heeeeeeelp. Now I'm trying the (2) way you showed in VBS, however, if possible, I want a simpler. Do you know some?
Quote: > Is that the actual syntax you were using? > I am not certain what your method is. Are you using ASP, straight > HTML, or a VBScript file? > For ASP, I'm not certain of the exact method. > For incusion within HTML, you can include something like: > <script src="./sub01.vbs"></script> > For use with WSH, you have a couple of choices: > (1) you can use a WSF with a <script src="..."> block similar to > within HTML. > (2) To evaluate from within VBScript, try the following: > Set fso = CreateObject("Scripting.FileSystemObject") > Const ForReading = 1, ForWriting = 2 > Dim fso, f > 'get Text file read in > Set f = fso.OpenTextFile("sub01.vbs", ForReading) > strInFileText = f.ReadAll > execute strInFileText
> > For example > > if include sub01.vbs, sub02.vbs, sub03.vbs; > > # include file="sub01.vbs" > > # include file="sub01.vbs" > > # include file="sub01.vbs" > > cause simply Err.. > > Could you let me know what's wrong above? > > Thanks in advance. > > ----------------------------------------- > > Osamu Terao
> > -----------------------------------------
|
Fri, 09 Jul 2004 21:42:27 GMT |
|
|
Alex Angelopoulo #6 / 7
|
How to include other VBS files
That's actually fairly simple. What is the code you are trying to run?
Quote: > Thanks kind reply, > Actually I'm trying to include VBS files from a parent VBS file. > So far I have been played by, or fighting with, ASP, simply > thought the same way might work. > Then that caused Err, so asked heeeeeeelp. > Now I'm trying the (2) way you showed in VBS, however, if possible, > I want a simpler. Do you know some?
wrote in
> > Is that the actual syntax you were using? > > I am not certain what your method is. Are you using ASP, straight > > HTML, or a VBScript file? > > For ASP, I'm not certain of the exact method. > > For incusion within HTML, you can include something like: > > <script src="./sub01.vbs"></script> > > For use with WSH, you have a couple of choices: > > (1) you can use a WSF with a <script src="..."> block similar to > > within HTML. > > (2) To evaluate from within VBScript, try the following: > > Set fso = CreateObject("Scripting.FileSystemObject") > > Const ForReading = 1, ForWriting = 2 > > Dim fso, f > > 'get Text file read in > > Set f = fso.OpenTextFile("sub01.vbs", ForReading) > > strInFileText = f.ReadAll > > execute strInFileText
> > > For example > > > if include sub01.vbs, sub02.vbs, sub03.vbs; > > > # include file="sub01.vbs" > > > # include file="sub01.vbs" > > > # include file="sub01.vbs" > > > cause simply Err.. > > > Could you let me know what's wrong above? > > > Thanks in advance. > > > ----------------------------------------- > > > Osamu Terao
> > > -----------------------------------------
|
Sat, 10 Jul 2004 02:32:24 GMT |
|
|
Osamu Tera #7 / 7
|
How to include other VBS files
Sorry for delay to report my result, The way you have suggested; Set fso = CreateObject("Scripting.FileSystemObject") Const ForReading = 1, ForWriting = 2 Dim fso, f 'get Text file read in Set f = fso.OpenTextFile("sub01.vbs", ForReading) strInFileText = f.ReadAll execute strInFileText can work I found. So now I'm using above for my VBS in various way, thanks.
Quote: > That's actually fairly simple. > What is the code you are trying to run?
> > Thanks kind reply, > > Actually I'm trying to include VBS files from a parent VBS file. > > So far I have been played by, or fighting with, ASP, simply > > thought the same way might work. > > Then that caused Err, so asked heeeeeeelp. > > Now I'm trying the (2) way you showed in VBS, however, if possible, > > I want a simpler. Do you know some?
> wrote in
> > > Is that the actual syntax you were using? > > > I am not certain what your method is. Are you using ASP, straight > > > HTML, or a VBScript file? > > > For ASP, I'm not certain of the exact method. > > > For incusion within HTML, you can include something like: > > > <script src="./sub01.vbs"></script> > > > For use with WSH, you have a couple of choices: > > > (1) you can use a WSF with a <script src="..."> block similar to > > > within HTML. > > > (2) To evaluate from within VBScript, try the following: > > > Set fso = CreateObject("Scripting.FileSystemObject") > > > Const ForReading = 1, ForWriting = 2 > > > Dim fso, f > > > 'get Text file read in > > > Set f = fso.OpenTextFile("sub01.vbs", ForReading) > > > strInFileText = f.ReadAll > > > execute strInFileText
> > > > For example > > > > if include sub01.vbs, sub02.vbs, sub03.vbs; > > > > # include file="sub01.vbs" > > > > # include file="sub01.vbs" > > > > # include file="sub01.vbs" > > > > cause simply Err.. > > > > Could you let me know what's wrong above? > > > > Thanks in advance. > > > > ----------------------------------------- > > > > Osamu Terao
> > > > -----------------------------------------
|
Tue, 13 Jul 2004 22:53:39 GMT |
|
|
|