﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Using "Include" files in VBScript Without Using ASP</title><link>http://www.visualbasicscript.com/</link><description /><copyright>(c) VBScript Forum</copyright><ttl>30</ttl><item><title> RE: Using "Include" files in VBScript Without Using ASP (bbotts77)</title><description>  Thanks ebgreen.  I just stumbled across  it somewhere else a couple of minutes ago.  This link should help though. &lt;br&gt;   &lt;br&gt;  Thanks again, &lt;br&gt;  Ben &lt;br&gt;   &lt;br&gt;  &lt;blockquote class="quote"&gt;&lt;i&gt;&lt;/i&gt;&lt;br&gt;ORIGINAL:  ebgreen &lt;br&gt;   &lt;br&gt;  It is Windows Script Components &lt;a href="http://msdn.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx" target="_blank" rel="nofollow"&gt;http://msdn.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx&lt;/a&gt; &lt;br&gt;  &lt;/blockquote&gt; </description><link>http://www.visualbasicscript.com/fb.ashx?m=73801</link><pubDate>Tue, 30 Jun 2009 09:17:32 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (ebgreen)</title><description>  It is Windows Script Components &lt;a href="http://msdn.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx" target="_blank" rel="nofollow"&gt;http://msdn.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx&lt;/a&gt; </description><link>http://www.visualbasicscript.com/fb.ashx?m=73799</link><pubDate>Tue, 30 Jun 2009 09:13:29 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (bbotts77)</title><description>  &lt;blockquote class="quote"&gt;&lt;i&gt;&lt;/i&gt;&lt;br&gt; &lt;br&gt;  &lt;pre class="prettyprint"&gt;&amp;lt;package&amp;gt;
    &amp;lt;job id="DoneInVBS"&amp;gt;
    &amp;lt;?job debug="true"?&amp;gt;
        &amp;lt;script language="VBScript"&amp;gt;
           WScript.Echo "This is VBScript"
        &amp;lt;/script&amp;gt;
    &amp;lt;/job&amp;gt;
    &amp;lt;job id="DoneInJS"&amp;gt;
    &amp;lt;?job debug="true"?&amp;gt;
        &amp;lt;script language="JScript"&amp;gt;
           WScript.Echo("This is JScript"); 
        &amp;lt;/script&amp;gt;
    &amp;lt;/job&amp;gt;
 &amp;lt;/package&amp;gt;
 &lt;/pre&gt; &lt;br&gt;  &lt;/blockquote&gt; &lt;br&gt;   &lt;br&gt;  I don't consider myself a noob to VBScript, but I've never seen &amp;lt;package&amp;gt; or &amp;lt;job&amp;gt; tags.  Are these browser or interpreter specific?  Where can I get more info on how to use these tags? &lt;br&gt;   &lt;br&gt;  Thanks, &lt;br&gt;  Ben </description><link>http://www.visualbasicscript.com/fb.ashx?m=73796</link><pubDate>Tue, 30 Jun 2009 08:40:43 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (TNO)</title><description>  Another approach which IMO is the best way to do it: &lt;br&gt;   &lt;br&gt;  &lt;b&gt;MyFile.wsf&lt;/b&gt; &lt;br&gt;  &lt;pre class="prettyprint"&gt;
 &amp;lt;job id="Foo"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;?job debug="true"?&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="JScript" src="e:/lib/JSON.js"/&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="VBScript" src="e:/lib/RegList.js"/&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="VBScript"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 'Do Stuff
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;
 &amp;lt;/job&amp;gt;
 &lt;/pre&gt; &lt;br&gt;   &lt;br&gt;  Plus as you can see, you can mix languages. Its also possible to have multiple &lt;b&gt;&amp;lt;job&amp;gt;&lt;/b&gt; tags with different id's: &lt;br&gt;   &lt;br&gt;  &lt;pre class="prettyprint"&gt;
 &amp;lt;package&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;job id="DoneInVBS"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;?job debug="true"?&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="VBScript"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "This is VBScript"
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/job&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;job id="DoneInJS"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;?job debug="true"?&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="JScript"&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo("This is JScript"); 
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/job&amp;gt;
 &amp;lt;/package&amp;gt;&lt;/pre&gt; &lt;br&gt;   &lt;br&gt;  This gives you the added power to execute each piece individually from the command line: &lt;br&gt;   &lt;br&gt;  &lt;b&gt;cscript myScript.wsf //job:DoneInJS&lt;/b&gt; &lt;br&gt;  &lt;b&gt;cscript myScript.wsf //job:DoneInVBS&lt;/b&gt; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=72250</link><pubDate>Tue, 12 May 2009 12:37:33 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (DiGiTAL.SkReAM)</title><description>  Actually, I didn't know. hehehe&amp;nbsp; I work pretty exclusively in vanilla vbscript.&amp;nbsp; .WSC, etc. are just random groupings of letters used to form arcane and mysterious filename externsions to me.&lt;img src="http://www.visualbasicscript.com/upfiles/smiley/s6.gif" alt="" /&gt; &lt;br&gt;  When i want to get REALLY crazy and wild, I write a .HTA.&lt;img src="http://www.visualbasicscript.com/upfiles/smiley/s14.gif" alt="" /&gt; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  I thought you were referring to the ExecuteGlobal and Execute commands.&lt;img src="http://www.visualbasicscript.com/upfiles/smiley/s1.gif" alt="" /&gt; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=58230</link><pubDate>Thu, 20 Mar 2008 03:23:08 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (TNO)</title><description>  Creating a Windows Script component as you know, turns your script into a COM component basically. So, &lt;br&gt;   &lt;br&gt;  &lt;b&gt; &lt;br&gt;  Dim TNO &lt;br&gt;  Set TNO = CreateObject("TNO.Framework");&lt;/b&gt; &lt;br&gt;   &lt;br&gt;  Can be used in the browser, HTML Application and on an ASP page as &lt;b&gt;Server.CreateObject("TNO.Framework")&lt;/b&gt; &lt;br&gt;   &lt;br&gt;  When I say this is IE only, I mean if I used the above in my webpage using JavaScript: &lt;br&gt;  &lt;b&gt; &lt;br&gt;  var TNO = new ActiveXObject("TNO.Framework");&lt;/b&gt; &lt;br&gt;   &lt;br&gt;  I don't expect Opera, Safari, FireFox, etc to execute it, forcing me to create a separate library. &lt;br&gt;   &lt;br&gt;  But, I may have spoken too soon, I haven't tested this yet, but perhaps by using the &lt;b&gt;&amp;lt;object&amp;gt;&lt;/b&gt; tag instead and/or &lt;b&gt;GeckoActiveXObject()&lt;/b&gt; would still allow sharing the same file across client/server. But of course I have no idea if a .wsc can be used in this manner (not using activeXObject/CreateObject) </description><link>http://www.visualbasicscript.com/fb.ashx?m=58225</link><pubDate>Wed, 19 Mar 2008 17:41:00 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (DiGiTAL.SkReAM)</title><description>  When you say 'too bad this is IE only technology', what exactly are you referring to? &lt;br&gt;  &amp;nbsp; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=58224</link><pubDate>Wed, 19 Mar 2008 17:26:44 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (TNO)</title><description>  I think this was one of the reasons why script components were invented. Just too bad this is IE only technology. </description><link>http://www.visualbasicscript.com/fb.ashx?m=58221</link><pubDate>Wed, 19 Mar 2008 16:16:16 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (ehvbs)</title><description>  Hi Fredledingue, &lt;br&gt;    &lt;br&gt;   &lt;b&gt;ExecuteGlobal&lt;/b&gt;: &lt;br&gt;   &amp;nbsp;&amp;nbsp; Executes one or more specified statements in the &lt;b&gt;global&lt;/b&gt; namespace of a  script. &lt;br&gt;    &lt;br&gt;    &lt;br&gt;   &lt;b&gt;Execute: &lt;br&gt;   &lt;/b&gt; &lt;br&gt;   &lt;b&gt;&amp;nbsp;&amp;nbsp; &lt;/b&gt;Executes one or more specified statements. &lt;br&gt;    &lt;br&gt;   This explanation straight from the VBScript Docs doesn't explicitly say what "non &lt;br&gt;   global" means, but they provide an example showing it by code. &lt;br&gt;    &lt;br&gt;   If you use your "Execute oFile.readAll" in a sub or function you can get at &lt;br&gt;   x, y, z in this sub/function only (the execution is local to the sub/function). &lt;br&gt;   By using ExecuteGlobal (even in a sub/function) you add your variables (and &lt;br&gt;   possibly subs/functions/classes from you file) to the global namespace of &lt;br&gt;   your script. &lt;br&gt;    &lt;br&gt;    &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=29894</link><pubDate>Sat, 14 Jan 2006 13:21:34 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (Fredledingue)</title><description>  It can be useful for codes that are shared by a large number of vbs. &lt;br&gt;  &amp;nbsp; &lt;br&gt;  I often use this method to pass parameters. I have in my file for example: &lt;br&gt;  &amp;nbsp; &lt;br&gt;  x=1 &lt;br&gt;  y=2 &lt;br&gt;  z=3  &lt;br&gt;  string = "my string" &lt;br&gt;  &amp;nbsp; &lt;br&gt;  ... &lt;br&gt;  &amp;nbsp; &lt;br&gt;  Then I open this file for reading and do &amp;nbsp;"Execute oFile.readAll". &lt;br&gt;  &amp;nbsp; &lt;br&gt;  What's the difference between "Execute" and "ExecuteGlobal"? &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=29893</link><pubDate>Sat, 14 Jan 2006 13:06:10 GMT</pubDate></item><item><title> RE: Using "Include" files in VBScript Without Using ASP (ebgreen)</title><description>  There is a function here that will do this with some error checking: &lt;br&gt;   &lt;a href="http://www.visualbasicscript.com/m_29285/tm.htm" target="_blank" rel="nofollow"&gt;http://www.visualbasicscript.com/m_29285/tm.htm&lt;/a&gt; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=29821</link><pubDate>Thu, 12 Jan 2006 13:50:46 GMT</pubDate></item><item><title> Using "Include" files in VBScript Without Using ASP (DiGiTAL.SkReAM)</title><description>  I searched, and didn't find anything else on this topic, so figured I'd post.&amp;nbsp; If someone else has done this before, I am reasonably certain that some folks will take great pleasure in pointing it out to me. &lt;br&gt;  To use an include file in a vbscript, without have to reference it via ASP/HTA/html tags, etc. do the following: &lt;br&gt;  The 'include' file can contain any normal vbscript, etc. that you would have in any other .vbs file, including subs and functions. &lt;br&gt;  &amp;nbsp; &lt;br&gt;  To access the code, &lt;br&gt;  &amp;nbsp; &lt;br&gt;  set oFile = fso.OpenTextFile(sFileName,1) &lt;br&gt;  sText = oFile.ReadAll &lt;br&gt;  oFile.close &lt;br&gt;  ExecuteGlobal sText &lt;br&gt;  &amp;nbsp; &lt;br&gt;  And voila, the commands that you had in the include file are ran. &lt;br&gt;  &amp;nbsp; &lt;br&gt;  &amp;nbsp; &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=29820</link><pubDate>Thu, 12 Jan 2006 13:47:03 GMT</pubDate></item></channel></rss>
