Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


Return to article

Happy Holiday HTA
 

Once in a while it’s fun to do something a little different with scripting. For example, I created a HTML Application (HTA) that’s a greeting card for the holiday season. HolidayTree.hta uses basic timers with randomized colors to produce a colorful holiday tree with blinking multicolored lights and a Happy Holidays greeting (see Figure 1). You can find HolidayTree.hta in the 100488.zip file by clicking the Download the Code Here button, above. To “open” the card, simply double-click the HolidayTree.hta file.

If desired, you can easily personalize the greeting and change the color of the tree lights and the background. To change the greeting, open the file in Notepad and find the code

 <p align="center"><b>
  <font size="7" color="#800000">
  <span style="font-family: Brush
  Script MT"> Happy Holidays</span>
  </font></b></p>

Replace Happy Holidays with your greeting.

To change the color of the tree lights or background, you need hexadecimal color codes. I included the AddColor.hta in the 100488.zip file for this purpose. In the Add- Color.hta’s UI, click the Rainbow Chart button to create a red-green-blue (RGB) color chart in Microsoft Word. This chart consists of 180 different colored cells. Inside each cell is the RGB value that creates the color. After you find the color you want, you can convert the RGB number into the hex code in AddColor.hta. (If you’d like more information about AddColor.hta, see the VIP exclusive article “Add a Little Color to Your World” at windowsitpro.com/article/articleid/47800/add-a-little-color-to-your-world.html.)

After you have the hex codes for the colors you want to use, plug your hex color codes into HolidayTree.hta. The code

 <body bgcolor="#008080">

sets the background color. The code

 str = "#FF0000,#FFFF00,#FF00FF," & _
  "#00FF00,#00FFFF,#0000FF,#ADFF2F"
  str = str &
  ",#FF8C00,#FF1493,#FFCC00," & _
  "#FFEFD5,#8B008B"

sets the color of the tree lights. Happy holidays to you all!

—Jim Turner, domain administrator and applications developer, Computer Sciences Corp.

See associated figure







Reader Comments

Cute. ?

bigubax -December 12, 2008
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement