Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Looking for VBS script that will eject a CD drive

Status
Not open for further replies.

warp

Newbie level 1
Newbie level 1
Joined
Sep 25, 2004
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
14
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.
 

Re: cd eject script

Put this script in a blank text file and change extension to .vbs:

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(0).Eject

Put the number of drive that you want to eject
(0 for D:\, 1 for E:\ and so on...) in colCDROMs.Item(n).Eject.
 

cd eject script

it havent worked
what is wrong
i copied the same in the notepad
and changed the (n) to 2 since my drive is F
but got a error.

line 3
char 1
error invalid procedure call or argument
code 800A0005

binu g
 

Re: cd eject script

Probably you need a newer version of Windows Media Player.
I have Windows Media Player 9 version with Windows Xp Sp2 and it works good.
 

cd eject script

ok
is there any way i can work it out in win2003
or any modified script can work?

binu g
 

Re: cd eject script

You should install windows media player, or try to find wmp.ocx
in your windows system directory and re-register it
with this command: "regsvr32 wmp.ocx"
It should work...
 

cd eject script

still i got the same error,
i re-register the wmp.ocx.
it got successfully registered.


regards
binu g
 

Re: cd eject script

Try re-register also wmp.dll
with "regsvr32 wmp.dll"
what version do you have of this file? Mine is 9.0.0.3250

Install the last version of windows script for windows 2003 here is the link
https://www.microsoft.com/downloads...82-e3f5-4289-a5e3-6cbb818623aa&displaylang=en

I have also found this script, but it doesn't work in my system :cry: :

Const CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & ":\"
End If
Next

Sub Eject(CDROM)
Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
 

cd eject script

i had it but it just ejects E: cd rom
 

Re: cd eject script

I made this little app, I hope that you find it useful. You need visual basic 6 runtime to run it, there is also the source code.

Regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top