Jump to content

Eject CD Tray - but don't know drive letter


Recommended Posts

I have searched and found some possible solutions but they don't seem as simple as they *should*?

I'd like to be able to create a button which will eject a CD tray.

I know about CDTray ( "drive", "status" ) but the problem is I don't know what the CD drive letter will be on each different machine.

I'm working on a solution using DriveGetDrive( "CDROM" ) and If FileExists () as I don't want the wrong tray to be ejected if there is more than one CD drive on a computer.

However, as the script will be run from the CD drive, I thought there might be a way to just find the current drive's letter, then use it in CDtray().

TIA ;),

[size=15]James :)[/size]www.8daysaweek.co.uk - A User-Focused OOo site, with Forums, Help Centre,Easy Installation CDs & OOo on USB Key

Link to comment
Share on other sites

@scriptXXX & some stringXXX functions should get it easily.

but can a script eject itself ?

MsgBox(0, 'Run From', StringLeft(@scriptdir, 2))
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Hi w0uter,

They do, thank you ;)

It works, so it would appear the answer is yes :P

Thanks for your help BFN,

this may help as i found it for another of my programs

hkcu/Software\Microsoft\Windows\Currentversion\Explorer\CD BurningaDrive Index gives the number of the burning drive.

Hk Users\.DEFAULT\Software\Microsoft\Windows\Currentversion\Explorer\MountPoints2 list all available drives

match the number to the drive and you have your cd burning drive

it shouldnt be too difficult in AutoIt

Who needs puzzles when we have AutoIt!!

Link to comment
Share on other sites

  • 1 month later...

I have searched and found some possible solutions but they don't seem as simple as they *should*?

I'd like to be able to create a button which will eject a CD tray.

I know about CDTray ( "drive", "status" ) but the problem is I don't know what the CD drive letter will be on each different machine.

Maybe this topic will help you:

http://www.autoitscript.com/forum/index.php?showtopic=16588

monter.FM [font="Tahoma;"]Full programs:[/font][font="'Microsoft Sans Serif';"] LogOnOff - keeps alive user session, after set time it performs logoff (instead of locking [acronym="Personal Computer"]PC[/acronym], useful in some corporations working with [acronym="Active Directory"]AD[/acronym]).[/font] ČharCönvěr - character set converter. [font="'Microsoft Sans Serif';"]CDTray - automated opening/closing the [acronym="Compact Disc"]CD[/acronym] tray.[/font] [font="'Microsoft Sans Serif';"]Example scripts: [/font][font="'Microsoft Sans Serif';"]RecentFolders - managing recently used folder list with combobox.[/font] [font="'Microsoft Sans Serif';"]AutoUpdater - periodic auto-checking, auto-updating and auto-relaunching newest script version.[/font] Changed host from monter.homeip.net to monter.homenet.org - replace address in my scripts to get back them to work.

Link to comment
Share on other sites

I have searched and found some possible solutions but they don't seem as simple as they *should*?

I'd like to be able to create a button which will eject a CD tray.

I know about CDTray ( "drive", "status" ) but the problem is I don't know what the CD drive letter will be on each different machine.

I'm working on a solution using DriveGetDrive( "CDROM" ) and If FileExists () as I don't want the wrong tray to be ejected if there is more than one CD drive on a computer.

However, as the script will be run from the CD drive, I thought there might be a way to just find the current drive's letter, then use it in CDtray().

TIA :P ,

How about this:

$var = DriveGetDrive ( "CDROM" )
  CDTray($var[1], "open")
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...