Gagorian Posted January 5, 2005 Posted January 5, 2005 I thought there might be someone (like me) out there who doesn't want to open the CD tray manually when they're done installing so here is a windows script that ejects the cd tray.open.vbsConst CDROM = 4For Each d in CreateObject("Scripting.FileSystemObject").Drives If d.DriveType = CDROM Then Eject d.DriveLetter & ":\" End IfNextSub Eject(CDROM) Dim ssfDrives ssfDrives = 17 CreateObject("Shell.Application")_ .Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")End Sub
Gagorian Posted January 5, 2005 Author Posted January 5, 2005 Well, I thought I should also post one to close it.. This one is a bit trickier. First of all you need wshAPIToolkitobject.ocx (one option). Copy it into system32 and run regsvr32 wshAPIToolkitobject.ocxclose.vbsDim oATO Set oATO = WScript.CreateObject("wshAPIToolkitObject.ucATO", "")Const ssfDRIVES = &H11Const DriveTypeCDROM = 4 Set oFS = Wscript.CreateObject("Scripting.FileSystemObject") Set oDrives = oFS.Drives For Each Drive in oDrives If Drive.DriveType = DriveTypeCDROM Then cdromDrvLtr = ("Drive.DriveLetter") End If Next Set oSH = CreateObject("Shell.Application")nRtn = oATO.CallAPI("WINMM.DLL", "mciSendStringA", "Set CDAudio door closed", 0, 0, 0)wshAPIToolkitObject.ocx
un4given1 Posted January 5, 2005 Posted January 5, 2005 You have a robot to remove the CD from the already opened CD tray too? Maybe one to turn it on and put the CD in the tray to begin with...
MCT Posted January 5, 2005 Posted January 5, 2005 this is posted on http://unattended.msfn.orgDownload: CDR - a command line CD Drive Ejector utilityCDR.exe is a command line utility which you can execute to eject one or more CD/DVD drives. This can be used as a replacement for the cd_eject.vbs script file, which wasn't all that great in terms of functionality. Use CDR.exe /? for a full list of switches and examples. Why would you want to use this tool? This can be handy to eject your Windows XP CD before performing replace/delete commands in the Windows or System32 directories, in which case Windows File Protection can intefere at times when the CD is in the drive.Usage: CDR.exe open ALLThanks to devil270975 for developing this tool for MSFN.orgIMO, this is easier
Shotgun Posted January 5, 2005 Posted January 5, 2005 You have a robot to remove the CD from the already opened CD tray too? Maybe one to turn it on and put the CD in the tray to begin with...Maybe he's got hold of an ASIMO...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now