#INCLUDE in WSH 
Author Message
 #INCLUDE in WSH

Hi,

    How can I include another script file in WSH? Some examples, please..
Appreciate it.

Khin Zaw
Seattle, WA



Mon, 16 Sep 2002 03:00:00 GMT  
 #INCLUDE in WSH
as a .wsf file...

<job>
<script language="javascript" src="myscript.js" />
<script language="javascript" >
...
..."mainline" jscript here...
...
</script>
</job>

--
Michael Harris
MVP Scripting

Hi,

    How can I include another script file in WSH? Some examples, please..
Appreciate it.

Khin Zaw
Seattle, WA



Mon, 16 Sep 2002 03:00:00 GMT  
 #INCLUDE in WSH

| Hi,
|
|     How can I include another script file in WSH? Some examples, please..
| Appreciate it.
|
| Khin Zaw
| Seattle, WA

eval(Include("myfile.js"))

function Include(file)
 {
     var fso, f;
     fso = new ActiveXObject("Scripting.FileSystemObject");
     f =  fso.OpenTextFile(file, 1);
     str = f.ReadAll();
     f.Close();
     return str;
  }

Greetings, Ansgar



Tue, 17 Sep 2002 03:00:00 GMT  
 #INCLUDE in WSH
You can make a module, and use the fuctions from the module. There is
information on this at the official MS Script WebSite

Quote:
> Hi,

>     How can I include another script file in WSH? Some examples, please..
> Appreciate it.

> Khin Zaw
> Seattle, WA



Tue, 17 Sep 2002 03:00:00 GMT  
 #INCLUDE in WSH
Thanks for all the replies, I forgot to mention that this script will be
executing on one of our production servers, with NT4/OP. In other words, it
has WSH 1.0 with VBS 2.0 running, I cannot upgrade to WSH 2. Anyway, I
believe INCLUDE was not available in WSH 1, if I can recall correctly, if
not please let me now.

Khin Zaw
Seattle, WA


Quote:

> | Hi,
> |
> |     How can I include another script file in WSH? Some examples,
please..
> | Appreciate it.
> |
> | Khin Zaw
> | Seattle, WA

> eval(Include("myfile.js"))

> function Include(file)
>  {
>      var fso, f;
>      fso = new ActiveXObject("Scripting.FileSystemObject");
>      f =  fso.OpenTextFile(file, 1);
>      str = f.ReadAll();
>      f.Close();
>      return str;
>   }

> Greetings, Ansgar



Fri, 20 Sep 2002 03:00:00 GMT  
 #INCLUDE in WSH
Ansgar's JScript example will work with JScript version 2.0 and WSH 1.0.

There still isn't a true INCLUDE even in the current versions script languages (.wsf <script>
elements added in WSH 2.0 are a host feature, not a script language feature), only more techniques
to get that effect.  If you're stuck with WSH 1.0 and version 2.0 language engines and you MUST have
the ability to "include" then you'll have to use JScript...

--
Michael Harris
MVP Scripting

Thanks for all the replies, I forgot to mention that this script will be
executing on one of our production servers, with NT4/OP. In other words, it
has WSH 1.0 with VBS 2.0 running, I cannot upgrade to WSH 2. Anyway, I
believe INCLUDE was not available in WSH 1, if I can recall correctly, if
not please let me now.

Khin Zaw
Seattle, WA


Quote:

> | Hi,
> |
> |     How can I include another script file in WSH? Some examples,
please..
> | Appreciate it.
> |
> | Khin Zaw
> | Seattle, WA

> eval(Include("myfile.js"))

> function Include(file)
>  {
>      var fso, f;
>      fso = new ActiveXObject("Scripting.FileSystemObject");
>      f =  fso.OpenTextFile(file, 1);
>      str = f.ReadAll();
>      f.Close();
>      return str;
>   }

> Greetings, Ansgar



Fri, 20 Sep 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Equivalent of #include under WSH?

2. INCLUDE Using WSH?

3. Anyway to do an include in WSH/VBS?

4. Doing includes in WSH 2.0 beta?

5. Include in WSH with VBScript 5

6. Include in WSH?

7. include in wsh vbs scripts

8. How could I do that include a WSH file in Web Server?

9. how do i include a 2nd wsh file

10. Include file for Javascript in WSH

11. ho do i include a 2nd wsh file

12. Extending WSH (including TS functions)

 

 
Powered by phpBB® Forum Software