SunQuest
 
       Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - HTML Applications: Giving WSH a User Inter...
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 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
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

HTML Applications: Giving WSH a User Interface
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-02-05

    Table of Contents:
  • HTML Applications: Giving WSH a User Interface
  • Creating your first HTA
  • Building the page
  • Taking it one step further

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    HTML Applications: Giving WSH a User Interface - Creating your first HTA


    (Page 2 of 4 )

     

    Like all other scripts, HTAs are nothing more than simple text files. They use the .hta file extension and can be executed directly. They take the form of an html file. Those of you familiar with browser scripting will find making the transition very easy.

    You’ll be able to take advantage of both the WSH environment as well as the browser DOM. Since HTAs execute in a subset of Internet Explorer, you’ll also be able to do most anything the browser itself can do. That means (among other things) that you have XHTML, HTML, CSS, and JavaScript at your disposal. If you can do it inside your browser, chances are good that you can do it in an HTA as well.

    A basic HTA script looks quite similar to a traditional HTML page. There are two things that I find quite refreshing about HTAs as opposed to web development. In an HTA, you’re always using Internet Explorer. This eliminates a need for cross-browser compatibility. Second, you don’t have to concern yourself with validation.  While I recommend getting used to XHTML’s “table-less” design, you can freely use them in HTAs and no one will ever know the difference.

    <html>

    <head><title>My HTA</title>

    <HTA:APPLICATION ID="oHTA";

      APPLICATIONNAME="Visual Ping";

      BORDER="thin";

      BORDERSTYLE="normal";

      SINGLEINSTANCE="no";

     />

    </head>

    <body>

    </body>

    </html>

    As you can see, an HTA is constructed of simple HTML. The only difference is the inclusion of the HTA:APPLICATION object. The addition of this object is what allows you to use the HTA DOM. You can set its exposed properties in the form of attributes.  For a complete list of attributes, please visit the MSDN HTML Application Reference.

    Notice the inclusion of the ID attribute. This allows us to assign a reference to the HTA:APPLICATION object. You will use this reference later in your script whenever you need to access the properties or methods associated with the HTA DOM.

    This code doesn’t do much at this point. A blank page isn’t very useful. We need to add some HTML.

    We’re going to make an HTA that performs a simple ping operation. It will then return the result back into our window. But before we get too involved, let’s get some simple stuff out of the way.

    More Windows Scripting Articles
    More By Nilpo


     

    WINDOWS SCRIPTING ARTICLES

    - Understanding Procedures in VBScript
    - Printing Documents in WSH
    - Generating Outlook Signatures Based on Activ...
    - VBScript: Converting and Formatting with Fun...
    - VBScript: Conversion and Format Functions
    - VBScript: Array Functions
    - VBScript: Strings, You Can`t Function withou...
    - VBScript: More String Functions
    - VBScript: Functioning with Strings
    - Working with the Windows Registry in C++
    - Understanding Objects
    - HTML Applications: Giving WSH a User Interfa...
    - Modifying Computer Objects with Active Direc...
    - Logon Script to Send Email Notifications
    - Securing Computers and Active Directory




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway