Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for cdrom.kix

(view source code of cdrom.kix as plain text)

  1. Break On
  2.  
  3. $KixMajorVer = SubStr( @Kix, 1, InStr( @Kix, "." ) - 1 )
  4. If $KixMajorVer < 4
  5. 	GoTo Syntax
  6. EndIf
  7.  
  8. $Drives = GetObject("winmgmts:").ExecQuery("select Name,DriveType from Win32_LogicalDisk where DriveType = 5")
  9.  
  10. If @Error <> 0
  11. 	? @Error + " / " @SError
  12. Else
  13. 	For Each $Drive In $Drives
  14. 		$Count = 1 + $Count
  15. 		$CDROM = "$CDROM " + $Drive.Name
  16. 	Next
  17. 	$CDROM = Right( $CDROM, Len( $CDROM ) - 1 )
  18. 	If $Count > 1
  19. 		$Drv = "drives"
  20. 	Else
  21. 		$Drv = "drive"
  22. 	EndIf
  23. 	? "$Count CD-ROM $Drv found on \\@Wksta: $CDROM"
  24. 	?
  25. EndIf
  26.  
  27. Quit 0
  28.  
  29.  
  30. :Syntax
  31. ? "CDROM.kix,  Version 1.10"
  32. ? "Display CD-ROM drive letters for the local computer."
  33. ?
  34. ? "Usage:  KIX32  CDROM.KIX"
  35. ?
  36. ? "Written by Rob van der Woude"
  37. ? "http://www.robvanderwoude.com"
  38. ? "This is a modified version of the GetDrvs.kix sample"
  39. ? "(Copyright (C) 2001 Ruud van Velsen) that comes with KiXtart 4.*"
  40. ?
  41. ? "This script requires KiXtart 4.00 or later."
  42. ? "Your KiXtart version is @Kix"
  43. ?
  44. Quit 1
  45.  

page last uploaded: 2017-08-21, 14:26