home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2004 February / CD Rom Data Şubat 2004.iso / Media / Internet / host-mon.exe / Examples / Scripts / DiskSpaces.vbs < prev    next >
Encoding:
Text File  |  2002-10-22  |  1.3 KB  |  41 lines

  1. '-----------------------------------------------------------------------------
  2. 'File    : DiskSpaces.VBS
  3. 'Purpose : Sample script test for Advanced Host Monitor
  4. 'Comment : Checks difference between free disk space on drive C: and drive D: 
  5. '          Sets status to "Bad" when drive C: has less amount of free space 
  6. '          than drive D:
  7. 'Language: VBScript
  8. 'Version : 1.0
  9. 'Author  : KS-Soft (www.ks-soft.net)
  10. '-----------------------------------------------------------------------------
  11. Option Explicit
  12.  
  13. const statusAlive       = "Host is alive:"
  14. const statusDead        = "No answer:"
  15. const statusUnknown     = "Unknown:"
  16. const statusNotResolved = "Unknown host:"
  17. const statusOk          = "Ok:"
  18. const statusBad         = "Bad:"
  19. const statusBadContents = "Bad contents:"
  20.  
  21. '---- entry point ----
  22.  
  23. FUNCTION PerformTest()
  24.   DIM DeltaSpace
  25.   DeltaSpace = AvailableSpace("C:\") - AvailableSpace("D:\")
  26.   IF DeltaSpace >= 0 THEN
  27.      performtest = statusOk+CStr(DeltaSpace/1024)+" Kb"
  28.   ELSE
  29.      performtest = statusBad+CStr(DeltaSpace/1024)+" Kb"
  30.   END IF
  31. END FUNCTION
  32.  
  33. '------ function -----
  34.  
  35. FUNCTION AvailableSpace(drvPath)
  36.   Dim fso, d
  37.   Set fso = CreateObject("Scripting.FileSystemObject")
  38.   Set d = fso.GetDrive(fso.GetDriveName(drvPath))
  39.   AvailableSpace = d.AvailableSpace
  40. END FUNCTION
  41.