View Full Version : cd eject script
eXistenZ
14-07-2003, 01:36
Does anyone know a vbs script, or a program that will let me eject a specific CD drive? Ive found one that will eject all the drives, but not one that will eject a specific one.
post the script you have, or upload it somewhere and link to it.
i did have some java script that would do this. it was a joke webpage that made people think they were being hacked because it opened and closed the cd trays in a loop.
the long and short of it was,
a.) create a new instance of win media player in internet explorer
b.) identify the cd drives
c.) loop through the drives and issue a command to open it i.e. winobj.drive.a.open (thats not it but it was kinda like that i think).
i unfortunately lost my whole webserver due to a corrupted os on friday along with all my data but i'll see if i have a copy hiding on my local pc.
<SCRIPT language=VBScript>
<!--
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
End If
-->
</SCRIPT>
the above has not been tested...
but with a little changing you can create a script for each drive you want to eject and to run it is as simple as clicking a bookmark in ie or something.
eXistenZ
20-07-2003, 17:06
cool - used that script and changed it to:
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(0).Eject
for the 1st drive, and Item(1) for the second.
Cheers :D
you could try Wizmo, a neat program that you can use to automate tasks with shortcuts in Windows, easy to use too.
http://grc.com/wizmo/wizmo.htm
UnrealRocks
10-08-2003, 01:09
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(0).Eject
That will work but not on Win9x/ME or Linux unless they have installed a newer version of WMP!
That webpage auto eject script is a nightmare for me ... I have a case door which on the odd occasion I lock - I also have gear driven Drives = Burnt out motors!
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.