wyn10 Posted March 20, 2008 Posted March 20, 2008 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
Moderators SmOke_N Posted March 20, 2008 Moderators Posted March 20, 2008 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.
rudi Posted March 20, 2008 Posted March 20, 2008 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!
wyn10 Posted March 20, 2008 Author Posted March 20, 2008 Might be surprised at what $CDDrive[2] or even $CDDrive[3] have #include <array.au3> $aDrives = DriveGetDrive("cdrom") _ArrayDisplay($aDrives) How would i add that in?
Moderators SmOke_N Posted March 20, 2008 Moderators Posted March 20, 2008 How would i add that in?For $i = 1 to ubound($aDrives) - 1 CDTrayOpen($aDrives[$i]) NextIf 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now