Quick script to EJECT a CD. 
Author Message
 Quick script to EJECT a CD.

Is there a way to write a script in WSH to just eject a cd.  Possibly using
the IOCTL_CDROM_EJECT_MEDIA variable?  If so would one of you highly
intelligent developers please write me a rinky-dink script that will open
the CD-ROM drive?

Thanks for your help,

Mike



Sat, 11 Sep 2004 06:00:55 GMT  
 Quick script to EJECT a CD.
I have no clue what IOCTL_CDROM_EJECT_MEDIA means.

From a quick check of Google on these groups, using EJECT and CDROM, I found:

(1)
http://home.att.net/~wshvbs/index.htm
(scroll down, look at "Opening and Closing the CD-ROM Drawer")

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

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

(3) You can also use the Widnows Media Player; haven't investigated that one...

Quote:

> Is there a way to write a script in WSH to just eject a cd.  Possibly using
> the IOCTL_CDROM_EJECT_MEDIA variable?  If so would one of you highly
> intelligent developers please write me a rinky-dink script that will open
> the CD-ROM drive?

> Thanks for your help,

> Mike



Sat, 11 Sep 2004 06:41:02 GMT  
 Quick script to EJECT a CD.
Alex,

Thanks for your help.   The WSH worked fine.

Thanks again,

Mike

"Alex K. Angelopoulos" <alex_angelopoulos_at_hotmail_dot_com_remove__> wrote

I have no clue what IOCTL_CDROM_EJECT_MEDIA means.

From a quick check of Google on these groups, using EJECT and CDROM, I
found:

(1)
http://home.att.net/~wshvbs/index.htm
(scroll down, look at "Opening and Closing the CD-ROM Drawer")

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

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

(3) You can also use the Widnows Media Player; haven't investigated that
one...


Quote:
> Is there a way to write a script in WSH to just eject a cd.  Possibly
using
> the IOCTL_CDROM_EJECT_MEDIA variable?  If so would one of you highly
> intelligent developers please write me a rinky-dink script that will open
> the CD-ROM drive?

> Thanks for your help,

> Mike



Sat, 11 Sep 2004 22:38:45 GMT  
 Quick script to EJECT a CD.
Quote:
> (3) You can also use the Widnows Media Player; haven't investigated that

one...

Here is a way to use WMP to open the cdrom drawer:

--- <snip> ---
Set oWMP = CreateObject("WMPlayer.OCX.7")

' test connecting with the cdromCollection interface...
nCDROM_Drives = oWMP.cdromCollection.Count
MsgBox("CDROM drive count is: " & CStr(nCDROM_Drives))

' if cdrom collection found, then execute eject method
'   on the first item (drive) in the collection...
if nCDROM_Drives >= 1 then oWMP.cdromCollection.Item(0).eject
--- <snip> ---

cheers, jw



Sun, 12 Sep 2004 03:46:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Ejecting CD's

2. Eject my cd drive ?

3. Eject my cd drive

4. Eject CD-ROM

5. ejecting CD-Rom with VBScript?

6. Remotely Eject a CD

7. Eject CD

8. eject command for CD Player

9. Newbie question : Ejecting a CD-Rom

10. Ejecting cd's

11. Using VB script to format a CD-R and Finish it through UDF

12. Change CD-Rom driveletter via script...

 

 
Powered by phpBB® Forum Software