Windows Scripting
  Home arrow Windows Scripting arrow Using Includes in VBScript
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Using Includes in VBScript
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2007-03-27

    Table of Contents:
  • Using Includes in VBScript
  • Building the basic routine.
  • Executing the external code
  • Allowing for relative or absolute path names
  • Allowing for platform-specific paths
  • Testing the subroutine

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Includes in VBScript


    (Page 1 of 6 )

    There is one very useful feature missing from both VB and VBScript—the ability to have includes. Includes allow you to create code snippets in separate files and import them into your script at runtime. We’re going to create a cool work around to allow us to use them.

    Before I begin, I’d like to thank Dr. Tobias Weltner for giving me the idea.  His feature-packed VBS editor, SystemScripter, includes this workaround.  I’ve taken his idea and written it using my own code.  In the process of writing this article I’ve seen several other similar solutions.  Since I don’t know who had the idea first, I’ll give credit to the person who turned me on to it.

    So here’s the challenge:  to create a function or subroutine that will allow us to use includes in our scripts.  Code should be as concise as possible to reduce the amount of extra code we need while being able to operate under nearly any scripting situation.

    It should also be flexible.  We want to have a drop-in snippet that we can reuse in any code.  We also want it to be able to accept different attributes for different situations.  We’ll get into that in more detail later when you can see actual demonstrations of what I mean.

    So let’s get started.

    More Windows Scripting Articles
    More By Nilpo/Developer Shed Staff Writer


       · Everyone loves a good workaround. This one lets you take advantages of code...
       · Thank you so much for posting your code. This is EXACTLY what I was looking for....
       · Thank you so much for you kind words. I'm glad you found this code useful.
     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    Stay green...Green IT