Sign in to follow this  
Followers 0
bobheart

Open the cdtray

8 posts in this topic

this opens my cdtray but can you do it with have the drive letter ?

CDTray("F:", "open")

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thank you again .. I must bug the hell out of you . lol

But I'm happy for everything you help me with ..

Share this post


Link to post
Share on other sites

Just an additional thought:

for $i = 68 to 90
$opened = CDTray(Chr($i) & ":", "open")
... etc

This saves inputting all that alphabet.


[u][font="Arial"]Pete[/font][/u]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0