HTA to view disk space script _hta
Last Update:2017-01-18
Source: Internet
Author: User
<title> disk space View scripts </title>
Applicationname= "Disk space View Foot"
border= "Dialog"
Borderstyle= "Normal"
caption= "Yes"
Contextmenu= "No"
Maximizebutton= "No"
minimizebutton= "Yes"
Navigable= "No"
Scroll= "Yes"
Selection= "No"
Showintaskbar= "Yes"
Singleinstance= "Yes"
sysmenu= "Yes"
Version= "1.0"
Windowstate= "Normal"
>
<script language= "VBScript" >
<!--Insert code, subroutines, and functions here-->
Window.resizeto 500, 420
ileft= (window.screen.width-500)/2
itop= (window.screen.height-420)/2
Window.moveto Ileft,itop
Sub Window_onload
Getdiskspace
End Sub
Sub Getdiskspace
Const Hard_disk = 3
Const Size = 1048576
StrComputer = "."
Set objWMIService = GetObject ("winmgmts:" _
& "{impersonationlevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set Coldisks = objWMIService.ExecQuery _
("SELECT * from Win32_LogicalDisk Where drivetype =" & Hard_disk & "")
strhtml = "<table align=center width=95% bordercolor= #698cc2 border= ' 1 ' cellspacing= ' 0 ' cellpadding= ' 1 ' >"
strHTML = strhtml & "<tr>"
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & "Partition" & "</b>< ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & "Capacity &" </b>< ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & "used" & "</b>< ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & Unused "&" </b>< ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & Idle "&" </b>< ;/td> "
For each objdisk in Coldisks
Intfreespace = Objdisk.freespace/size
Inttotalspace = Objdisk.size/size
Pctfreespace = Intfreespace/size/inttotalspace/size
Inffulin = Inttotalspace-intfreespace
DeviceID = Objdisk.deviceid
strHTML = strhtml & "<tr>"
strHTML = strhtml & "<td width=110px align=center>" & DeviceID & "</td>"
strHTML = strhtml & "<td width=110px align=right>" & FormatNumber (inttotalspace,2,-1,-1,0) & "</td& gt; "
strHTML = strhtml & "<td width=110px align=right><font color= #DB2C00 >" & FormatNumber (inffulin,2,-1 , -1,0) & "</td>"
strHTML = strhtml & "<td width=110px align=right><font color= #008080 >" & FormatNumber (Intfreespace, 2,-1,-1,0) & "</td>"
strHTML = strhtml & "<td width=110px align=right>" & FormatPercent (Intfreespace/inttotalspace) & "< /TD> "
Next
strHTML = strhtml & "</table>"
dataarea.innerhtml = strHTML
End Sub
</script>
<body>
<!--HTML goes here-->
<table align=center width=95%><font color= "#C63358" ><b> disk space View script </b></font><br >
<font size= "2" > Display disk partition usage (<font color= "#FF0000" >/MB</font>) </font></font></ Table>
<body bgcolor= "#99CCFF" >
<span id = "DataArea" ></span>
</body>
Save as an HTA file.