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 / DrivesList.vbs < prev    next >
Encoding:
Text File  |  2002-10-16  |  1.8 KB  |  64 lines

  1. '-----------------------------------------------------------------------------
  2. 'File    : DrivesList.VBS
  3. 'Purpose : Sample script test for Advanced Host Monitor
  4. 'Comment : Checks list of disk drives on local system. Set test's status to 
  5. '          "Bad" when list of drives changes. E.g. when user map/unmap network
  6. '          drive.
  7. 'Req     : Test's option "Translate macros" must be enabled
  8. 'Language: VBScript
  9. 'Version : 1.0
  10. 'Author  : KS-Soft (www.ks-soft.net)
  11. '-----------------------------------------------------------------------------
  12. Option Explicit
  13.  
  14. const statusAlive       = "Host is alive:"
  15. const statusDead        = "No answer:"
  16. const statusUnknown     = "Unknown:"
  17. const statusNotResolved = "Unknown host:"
  18. const statusOk          = "Ok:"
  19. const statusBad         = "Bad:"
  20. const statusBadContents = "Bad contents:"
  21.  
  22. '---- entry point ----
  23.  
  24. FUNCTION performtest()
  25.   DIM CurrList
  26.   IF "%Reply%"="%"+"Reply"+"%" THEN
  27.      performtest = statusUnknown+"Please enable 'Translate macros' option"
  28.   ELSE
  29.     CurrList = GetDrivesList
  30.     IF CurrList<>"%Reply%" THEN
  31.        performtest = statusBad+CurrList
  32.     ELSE
  33.        performtest = statusOk+CurrList
  34.     END IF
  35.   END IF
  36. END FUNCTION
  37.  
  38. '----- functions -----
  39.  
  40. FUNCTION GetDrivesList()
  41.   DIM DList, FSO, Drive
  42.   DList = ""
  43.   Set FSO = CreateObject("Scripting.FileSystemObject")
  44.   For Each Drive In FSO.Drives
  45.       DList = DList + Drive.DriveLetter
  46.     Next
  47.   Set FSO = Nothing
  48.   GetDrivesList = DList
  49. END FUNCTION
  50.  
  51.  
  52. FUNCTION GetCdromDrives()
  53.   DIM DList, FSO, Drive
  54.   DList = ""
  55.   FSO = CreateObject("Scripting.FileSystemObject")
  56.   FOR Each Drive In FSO.Drives
  57.     If Drive.DriveType = 4 Then
  58.        DList = DList + Drive.DriveLetter
  59.     End If
  60.     Next
  61.   Set FSO = Nothing
  62.   GetCdromDrives = DList
  63. END FUNCTION
  64.