got a cd/dvd tray that hates it when you use the button and won't respond like it should ALL THE TIME (like me, lol)--try this #open notepad, copy and paste, replace drive letter with, you guessed it, the drive letter ie. C D E F etc.# Drive = "drive letter:\\" sa = new ActiveXObject("Shell.Application") fl = sa.NameSpace(Drive).Self fl.InvokeVerb("E&ject") #save as "whatever.js" and it doesn't have to be in the root dir or anything, save it anywhere you like and can find it# create a shortcut and place it on your desktop, double click and viola.
I did as instructed but nothing happens when I run the script ... absolutely nothing either good or bad. If I remove the quotes from line 1 I get an error message saying a ";" is expected in place of the ":" at position 10. Same results both with and without the "\\". Being unfamiliar with Javascript, most likely I'm not editing as you want it done.
surely you guys are joking??? 1) did you replace the words drive letter on the first line with the actual letter of the drive that you are wanting to eject, which should only be cd/dvd drives? zahnoo, 2) do not remove any quotes either, and it has to have these two \\ after the drive letter and colon 3) do you have the latest java installed? 4) did you save it as .js ? 5) do you have a virtual drive setup, such as Daemon tools or something like it? make sure you are using the physical drive's letter and not the virtual drive's letter (I had a similar issue the first time i tried it a couple of years ago because i put the wrong drive letter on the first line) Daemon tools often lists its virtual drive before the physical drive in "my computer" so check that... i'm running XP but i do not see why this wouldn't work with newer OSes. here is what my script looks like exactly, which works perfectly every time i double click: Drive = "H:\\" sa = new ActiveXObject("Shell.Application") fl = sa.NameSpace(Drive).Self fl.InvokeVerb("E&ject") "H:\\" is my cd/dvd drive--other examples: "C:\\" "D:\\" "E:\\" "F:\\" "G:\\" etc. etc. if it's not working after checking all these things, then i'm not sure why it doesn't work for you because i have no issues with it and i use it on a daily basis...
are you running vista by chance? i have heard of problems with vista and this script... otherwise i do not know??? there must be something amiss somewhere.
i surely wouldn't post something that didn't work if i thought that was the case though, guys, so i do apologize, but as i said before it works perfectly for me idk, really, but i can't find any reason why it will not work either. there are no syntax errors or anything, and i assure you i have no problems whatsoever, it works for me all the time and my pc isn't the most perfect but i don't have any java, active x, etc errors, so, idk... i tried running this on a vista machine which it didn't work, saying sa was not defined on line 3 even though it clearly is... i'm going to say that this clearly doesn't work with anything other than XP @ the moment and probably has something to do with the way the embedded security system works in Vista, 7, etc. which i had no idea would be the case and i can't really figure why either. could be an active X problem on you guys' machines, though i'm not quite sure it would be causing it not to work. someone running XP should try this or try it in your VM that is running XP; or you guys running 7 try running in XP compatibility mode and see if that works for you that way this is a download link to my script from my pc, there are no viruses i assure you as i've already posted the txt above; just edit H to your drive letter in the text and run here's the scan link: no maleware, virus, etc. http://virscan.org/report/4232108e6563452d6e081c215231fdc3.html http://www.mediafire.com/?tw2ipc314gtbjvc
just a follow up to this: this does not work in Windows 7 @ all, nor does it work in Windows Vista--and i still cannot figure out why. I think it has something to do with the "eject" context not being tied to activeX controls, but i'm not completely sure. But I have tested this on a few other machines running various other versions of XP and this script worked just fine as long as ActiveX and Java are installed and the proper letter is used for the drive.
Was about to say the same as searchengine. Why trying to re-invent the wheel? In fact first post was copied from here But if one needs more options then: http://thewalter.net/stef/software/eject/ http://www.rjlsoftware.com/software/utility/open_cd/ http://www.codeguru.com/cpp/w-p/system/cd-rom/article.php/c5775 http://ejectclosecdtray.codeplex.com/ http://www.mailsend-online.com/blog/a-command-line-cd-tray-opener.html http://www.exsense-software.com/index.php?page=softwares&software=disktray http://www.kanasolution.com/products/kana-cdisk/ http://www.alexnolan.net/software/commandline.htm sebus
actually it wasn't copied from "there" little trick i picked up from a nerd friend in fact. just now saw your post, but don't accuse me of something that you don't have the facts about...
eject cd here is a vbs scripe that I found which will eject a cd or dvd drive just past in in a txt file and rename the extension to vbs Dim ts Dim strDriveLetter Dim intDriveLetter Dim fs 'As Scripting.FileSystemObject Const CDROM = 4 On Error Resume Next Set fs = CreateObject("Scripting.FileSystemObject") strDriveLetter = "" For intDriveLetter = Asc("A") To Asc("Z") Err.Clear If fs.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then If Err.Number = 0 Then strDriveLetter = Chr(intDriveLetter) Exit For End If End If Next MSGBOX "YOUR CD IS: " & strDriveLetter,VBOKONLY + 48,"CDROM=> " & strDriveLetter Set oWMP = CreateObject("WMPlayer.OCX.7" ) Set colCDROMs = oWMP.cdromCollection For d = 0 to colCDROMs.Count - 1 colCDROMs.Item(d).Eject Next 'null 'A1= msgbox ("Press key To Close Cd" & vbcrlf &_ ' " The Cd Will Close", 0 + 64, "Open Close Cd Tray") ' For d = 0 to colCDROMs.Count 1 ' colCDROMs.Item(0).Eject 'Next 'null set owmp = nothing set colCDROMs = nothing wscript.quit
Nada..Nothing..No Mas.. let's be Democratic and take a vote.. All in Favor say Aye, all opposed Nay.. I think the Nays win on this one.. Personally I like this Working .vbs script that I use for my temperamental lap dvd drive and it never let's me down! Code: 'Auto Eject DVD Tray' For Each d in CreateObject("Scripting.FileSystemObject").Drives CreateObject("Shell.Application").Namespace(17).ParseName("E:\").InvokeVerb("Eject") Next
Here is a Tested solution for Vista and Windows 7 and now 8 that Works!..Will add "Eject DVD-RW Tray" with icon to your desktop right-click context menu.. (see bottom image) 1. Google and Download Nircmd either 32 or 64-bit as needed. 2. Then take the Eject.bat and nircmd.exe file and put then in your System32 folder. 3. Now merge the .reg file to the registry and your good to go! P.S. I chose Nircmd over a .vbs eject script because of false-postive with Windows saying the .vbs script was a joke eject virus. Code: @ echo off ::=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= :: No more fumbling around trying to push :: that effin' laptop tray button again! :: Designed for Windows Vista, 7 and 8. ::=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= :: Eject.bat ::• Scan-Detect-Go To DVD Drive Letter • ::==> CODE STARTS <== cd %~dp0 for %%a in (D E F G H I J) do ( fsutil.exe fsinfo drivetype %%a:|find "CD-ROM">nul&&set dvd=%%a:&&goto :%%a ) :: DRIVES :D start "" nircmd.exe cdrom open d: goto :eof :E start "" nircmd.exe cdrom open e: goto :eof :F start "" nircmd.exe cdrom open f: goto :eof :G start "" nircmd.exe cdrom open g: goto :eof :H start "" nircmd.exe cdrom open h: goto :eof :I start "" nircmd.exe cdrom open i: goto :eof :J start "" nircmd.exe cdrom open j: goto :eof :eof exit ::==> CODE ENDS <== ::rev. 11.28.12_Dos Probie ö¿ö Code: Windows Registry Editor Version 5.00 ;Eject.reg ; Add "Eject DVD-RW Tray" to right click menu [HKEY_CLASSES_ROOT\Directory\Background\shell\Eject DVD-RW Tray] "icon"="shell32.dll,-165" "Position"="Middle" [HKEY_CLASSES_ROOT\Directory\Background\shell\Eject DVD-RW Tray\command] @="Eject.bat"