Sign in to follow this  
Followers 0
wyn10

Trying to find....

5 posts in this topic

Im currently making a program that uses hotkeys to open/close the cdtray. I got a suggestion to add the dvdtray for it. But I cant find a fuction that will call it. Little help?

What i have so far:

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F1}", "Open")
HotKeySet("{F2}", "Close")
$CDDrive = DriveGetDrive("cdrom")
                                                      <<Trying to add the dvd varible here.

While 1
    Sleep(0)
WEnd

Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

Func Open()
    CDTray($CDDrive[1], "open")
EndFunc  ;==>Open

Func Close()
    CDTray($CDDrive[1], "close")
EndFunc  ;==>Close

Share this post


Link to post
Share on other sites



Might be surprised at what $CDDrive[2] or even $CDDrive[3] have :)

#include <array.au3>
$aDrives = DriveGetDrive("cdrom")
_ArrayDisplay($aDrives)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Hi.

My laptop has a hanging CD eject button. Depending on the image currently put on it the CD letter changes.

Eject function from Autoit works fine:

Dim $Alphabet
Dim $drive

For $Alphabet = 65 To 90

    If DriveGetType(Chr($Alphabet) & ":") = "CDROM" Then
        MsgBox(64, "CD/DVD auswerfen", "CD/DVD Laufwerk " & Chr($Alphabet) & ": wird geöffnet", 2)
        CDTray(Chr($Alphabet) & ":", "open")
    EndIf
Next

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

How would i add that in?

For $i = 1 to ubound($aDrives) - 1
    CDTrayOpen($aDrives[$i])
Next
If you want to get more information about the drive itself, might look at the computer udf's by jsthepatriot in the example forum, maybe it can determine which of the drives is actually what.

Or if you know the serial number of the DVD drive, then you may be able to do the loop, compare DriveGetSerial to a known serial and store the value in a variable and use CDTrayOpen/Close from there.

I'm sure you could get creative :).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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