Jump to content

Open the cdtray


Recommended Posts

can you do it with have the drive letter ?

Sorry, that just makes no sense to me. You need to give it both arguments if that's what you mean, yes. If not, please clarify.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Sorry i took my pills so kind of out of it right now .

Can you have it open a cdrom with out saying the drive letter ?

Like if you don't know what the drive letter would be on their computer.

Like MCI commands :

MCICommand("set cdaudio door open")

MCICommand("set cdaudio door closed"
Edited by bobheart
Link to comment
Share on other sites

No, but you could have it try the letters D through Z until it finally does open one. Like this:

;create an array with the drive letters D through Z:
$driveArray = StringSplit("DEFGHIJKLMNOPQRSTUVWXYZ", "")
For $i = 1 To 23 ;we have 23 elements in our array, so at most do this 23 times
  $opened = CDTray($driveArray[$i] & ":", "open")
  If $opened Then ExitLoop ;it worked, so don't keep trying more drive letters
Next
If NOT $opened Then ;it failed, so let the user know and exit
  MsgBox(0, "Failed", "Sorry, could not find a CD drive that would let me open it")
  Exit
EndIf

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

Hi,

This might also work:

$var = DriveGetDrive ( "CDROM" )

CDTray($var[1], "open")

Please take a look at the help file how DriveGetDrive works, I'm not sure if it is like suggested above.

Cheers,

Tuape

Link to comment
Share on other sites

$var = DriveGetDrive ( "CDROM" )

CDTray($var[1], "open")

Please take a look at the help file how DriveGetDrive works, I'm not sure if it is like suggested above.

Looks good, but be sure to test for the DriveGetDrive function failing (if there are no CDROM drives on the system.) Either check for $var = 1, or for @error. And I never saw that function before (or looked long enough to notice.) Ya learn something new every day :D

Minor edit

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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...