Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - WSH in Other Languages
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

WSH in Other Languages
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2008-08-11

    Table of Contents:
  • WSH in Other Languages
  • VBScript
  • Jscript
  • Python
  • More Languages

  • 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


    WSH in Other Languages - Jscript


    (Page 3 of 5 )

    Jscript was also released in 1996 by Microsoft to meet the ECMAScript scripting programming language specifications.  It most closely resembles Netscape’s own ECMAScript solution known as JavaScript.  While the terms Jscript and JavaScript are often erroneously used interchangeably, it is important to remember that the two represent completely different and independent entities.  Despite their close resemblance, Microsoft retained enough differences to keep the two languages incompatible.

    Because of Jscript’s wide use as a web development language, its support was also included in WSH natively.  This makes it the perfect alternative to VBScript for many administrators.

    var fso = new ActiveXObject("Scripting.FileSystemObject");

    An object can be accessed by creating a new instance of the object with the ActiveXObject method.  Just as in VBScript, an object is typically identified by its ProgID.

    var folder = fso.GetFolder("C: emp");

    Like VBScript, Jscript uses standard object dot syntax to access an object’s properties and methods.

    Working with Collections

    Unlike VBScript, Jscript cannot access collection objects directly.  You must first create an Enumerator object.

    var e = new Enumerator(folder.files);

    An enumerator object provides a mechanism for accessing and manipulating the objects found within a collection.

    for (e.moveFirst(); ! e.atEnd(); e.moveNext()) {

       var file = e.item();

       WScript.Echo(file.name);

    }

    Iterating through the enumerator’s items is then done using a For structure.

    Additional Notes About Jscript

    All statements in Jscript require a semi-colon line ending and parenthesis should be used to denote all methods even when you are not supplying parameters.

    Unlike VBScript, Jscript does maintain some case sensitivity.  Variables and object names are case sensitive, while an object’s property and method names are not.

    It is also important to remember that the forward slash is a reserved character and must be escaped whenever it appears in a string.

    More Windows Scripting Articles
    More By Nilpo


       · The Windows Script Host is not limited to VBScript and JScript. In fact, you can...
     

    WINDOWS SCRIPTING ARTICLES

    - 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...
    - Modifying XML Files in WSH
    - Reading XML Files in WSH
    - Visual Basic 2005 XML Programming Using XML ...
    - Creating an XML Document in WSH
    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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