1.

Solve : CD Drive Open?

Answer»

i was on a webpage once and pressed a link which opened my CD drive, how was this done, and how can i do it? :-?This little piece of doggeral will eject a CD:

Code: [SELECT]Set WMP = CreateObject("WMPlayer.ocx")
Set colCDROMS = WMP.CDROMCollection

If colCDROMS.Count > -1 Then
      For i = 0 to colCDROMS.Count - 1
            colCDROMS.Item(i).Eject
      Next
End If

Save with a vbs extension and run as cscript scriptname.vbs

You can also do this with Nero, google for exact details.

 8-)woah. can you EXPLAIN that in dumb person language please? im beginner toall this stuff.The code posted is a VBScript. You can copy and paste it into any editor, notepad is fine, then save the file with a vbs extension. VBScripts run under an interpreter, either wscript or cscript. You can run the script as cscript scriptname.vbs.

The script itself is a model of simplicity. Using the Windows Media Player object, it creates a COLLECTION of your CD drives. The script then iterates THRU the collection, ejecting the CD drives as it goes.

If you are using Win98 or ME you may have to change the line: Set WMP = CreateObject("WMPlayer.ocx") to Set WMP = CreateObject("WMPlayer.ocx.7")

 8-)

PS. CScript and WScript are included on most Windows machines and provide free support for VBScripts.ok i think i kinda get that now. ill reply again if i don't



Discussion

No Comment Found