Open CD-ROM Drive

This VBScript actually opens your CD-ROM drive without prompting, by accessing the Windows Media Player API. If you hate Internet Explorer, feel free to include the below sample code on every page of your own site.

July 29, 2003: The Windows Media Player API won't let you close the CD-ROM drive once it's open. Sorry.

Source Code

  1. <script language="vbscript">
  2. <!--
  3. Set oWMP = CreateObject("WMPlayer.OCX.7")
  4. Set colCDROMs = oWMP.cdromCollection
  5.  
  6. if colCDROMs.Count >= 1 then
  7. For i = 0 to colCDROMs.Count - 1
  8. colCDROMs.Item(i).Eject
  9. Next ' cdrom
  10. End If
  11. -->
  12. </script>

Share These Free Scripts

My Fancy Artistic Separator

Categories