Welcome to Scripting Forums Sign in | Join | Help
in Search

HTA Space Calculator

Last post 12-22-2007, 8:10 AM by jturnervbs. 0 replies.
Sort Posts: Previous Next
  •  12-22-2007, 8:10 AM 29085

    HTA Space Calculator

    This is a simple Space Calculator utility that lets you add various byte sizes together.

    Just copy the code into a text file and rename it with an .hta extension.

    Enjoy.

     

     <html>

    <head>
    <title>Space Calc</title>

    <HTA:APPLICATION
         ID="HTASpaceCalc"
         APPLICATIONNAME="HTA-SpaceCalc"
         SCROLL="no"
         SINGLEINSTANCE="no"
         WINDOWSTATE="normal"
    >

    <style>
    BODY
    {
       background-color: buttonface;
       font-family: Helvetica;
       font-size: 8pt;
       margin-top: 8px;
       margin-left: 8px;
       margin-right: 8px;
       margin-bottom: 3px;
    }
    </style>

    <SCRIPT language="VBScript">

    Sub DoCalc
     totamt = 0
     amt = 0
     amt2 = 0
     If Isnumeric(startamt.Value) AND (isnumeric(Addamt.Value) or Trim(Addamt.Value) = "") Then
      If R1(2).checked Then
       amt = startamt.value * (1024*1024*1024*1024)
      ElseIf R1(1).Checked Then
       amt = startamt.value * (1024*1024*1024)
      ElseIf R1(0).Checked Then
       amt = startamt.value * (1024*1024)
      End If

      If Trim(Addamt.Value) = "" Then
       amt2 = 0
      Else
       If R2(2).checked Then
        amt2 = addamt.value * (1024*1024*1024*1024)
       ElseIf R2(1).Checked Then
        amt2 = addamt.value * (1024*1024*1024)
       ElseIf R2(0).Checked Then
        amt2 = addamt.value * (1024*1024)
       End If
      End If

      totamt = amt + amt2
      newtotbytes.value = totamt
      newtotkilo.value = totamt / 1024
      newtotmega.value = totamt / (1024 * 1024)
      newtotgiga.value = totamt / (1024 * 1024 * 1024)
      newtottera.value = totamt / (1024 * 1024 * 1024 * 1024)
     Else
      Msgbox "Enter numeric values only"
     End If
    End Sub

    Sub startup
    '*** Put window in front, resize, set the month to the current month and self run routine
     self.focus
     self.ResizeTo 470,510 'w,h
     StartAmt.focus
    End sub

    </SCRIPT>
    </head>

    <BODY onload="startup">
    <H2 ID="Heading" align="left">Space Calc</H2>
    <ul>
     <li>
     <p align="left">Enter Starting Amount, add additional amount and press
     RunScript</li>
     <li>
     <p align="left">Leave Add amount Blank to see starting amount converted to
     other amount forms</li>
    </ul>
    <p align="left">Starting Amount <input type="text" name="StartAmt" size="10">
    <input type="radio" value="V1" name="R1">megabytes<input type="radio" value="V2" checked name="R1">gigabytes
    <input type="radio" value="V3" name="R1">terabytes</p>
    <p align="left">Add this amount <input type="text" name="AddAmt" size="10">
    <input type="radio" value="D1" name="R2" checked>megabytes<input type="radio" value="D2" name="R2">gigabytes
    <input type="radio" value="D3" name="R2">terabytes</p>
    <P>
    <textarea rows="1" name="NewTotbytes" cols="25"></textarea>bytes<P>
    <textarea rows="1" name="NewTotkilo" cols="25"></textarea>kilobytes<P>
    <textarea rows="1" name="NewTotmega" cols="25"></textarea>megabytes<P>
    <textarea rows="1" name="NewTotgiga" cols="25"></textarea>gigabytes<P>
    <textarea rows="1" name="NewTottera" cols="25"></textarea>terabytes<br>
    <br>
    <input type="button" name="OKButton"  onclick="DoCalc" value="RunScript" ><p><input type="button" value="Exit" onclick="window.close" name="B3"></p>
    </BODY>
    </html>

View as RSS news feed in XML
SPONSORED LINKS FEATURED LINKS

Free Download –VS 2008 TrainingExperts Ken Getz & Robert Green plus labs, code, courseware Maximize speed, performance and reliablity of your PCs and servers—automatically!Speed Up Your PC! Try Diskeeper 2008 with InvisiTasking Free Now! Register for SolarWinds VM MonitorGet X-Ray Vision into Your ESX Servers with SolarWinds FREE VM Monitor GoGrid Offers FREE Trial for Windows Cloud ServersDeploy Windows Server 2003 and 2008 with free load balancing through GoGrid’s award winning web-based GUI – all in less than 5 minutes Order Your SQL Fundamentals CD Today! Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD. How healthy is your Exchange Server? Find out Now!Automatic Exchange Server Maintenance helps prevent disasters and improves performance. Download a FREE Exchange Server analysis tool. You've Deployed SharePoint...Now What?This one-day free online conference delivers the technical knowledge needed to kick MOSS up a notch. In one information-packed day, independent SharePoint experts will present practical, real-world information and provide take-away, ready-to-use solutions Ease Your Scripting Pains with the Flexibility of PowerShell!Paul Robichaux equips you with PowerShell basics in 3 introductory lessons, each followed by live Q&A—all on your own computer! Register today! What Would You Do If You Ran Microsoft?ITTV's 2008 inaugural video contest, "If I Ran Microsoft..." is your chance to tell it like it is. Be goofy or be serious, but don"t miss this chance to have fun, win prizes, and go viral in a major way. Maximize Your SharePoint InvestmentThis web seminar discusses how true bi-directional replication of SharePoint content from one server to another enables branch offices to maintain access to current SharePoint content. Rock Your Knowledge, and Compete with Friends and Colleagues!Are you the Web Application Performance Guru in your office? It's time to have fun! Download now to access the crossword puzzle. Challenge yourself and complete this fun activity!

 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing