Thanks, David! The script (with your excellent comments, I might add
is
useful, since it allows me to include the action in automated tasks - which
is what I was looking for. The other solutions are nice, but requires user
interaction.
Many programs (including the FlexiCD powertoy) are able to close the tray as
well, is there really no easy way we can include this function in a
script/batch/etc?
dOrK (prev. known as dOinK)
(in honor of you, Candy ;-)
You did want to comment on me in another thread. I'm just paying you back.
To pop the drawer in or out one sends media commands to the drive. There's
sample code galore to that.
To script it one needs to get a reference to the drive, then invoke the
Eject verb.
You get a reference to My Computer. Then the item in My Comp. Then the verb.
This is not under scripting but under Shell.
Attached is a sample for E drive change to suit. Read the file as their are
comments in there and you'll have to set your drive letter anyway. Least you
use a newsreader so you'll actually see the file.
But why not just drag a shortcut then r/c it and choose Eject. The CD player
from 95 powertoys puts a icon next to clock. R/c it to eject or close.
http://www.microsoft.com/Windows95/downloads/contents/WUToys/W95PwrToysSet/Default.asp
See three ways.
For web interface maggots here it is printed. Make the window you are
reading this in big so it doesn't wrap.
----------------------------------------------------------------------------
--------------------
'Note if a letter is underlined you must insert an ampersand before it.
Set objShell = CreateObject("Shell.Application")
Set MyComp=objShell.NameSpace(17)
Set CD=MyComp.ParseName("E:\")
Set Context=CD.Verbs
CD.InvokeVerb "E&ject"
'This line on are comments only because of the ' (can't spell it )
'Normally only the first line and the line below is needed for most verbs.
Eject is different.
'objshell.ShellExecute "e:" ,,,"E&ject"
'eg
'object.ShellExecute(sFile [,vArguments] [,vDirectory] [,vOperation]
[,vShow])
----------------------------------------------------------------------------