;Open/Close CD Tray ^+z:: DTray := !DTray DriveGet, DStatus, StatusCD, D: If DStatus In stopped,seeking,paused,playing DTray = 1 DStatus = If DTray = 1 { Drive, Eject, D: SetTimer, AutoCloseDTray, 15000 Return } If DTray = 0 { SetTimer, AutoCloseDTray, Off Drive, Eject, D:, 1 } Return ;Close CD Tray After 15 Seconds AutoCloseDTray: SetTimer, AutoCloseDTray, Off Drive, Eject, D:, 1 DTray = Return
Of course, you can remove the timer function and use it on it's own if you don't like this option.