windowsdiskcd-romnaturallyspeaking

How can I eject the CD-ROM drive with Dragon NaturallySpeaking's advanced scripting?


Is there any way to eject the CD-ROM drive with Dragon NaturallySpeaking's advanced scripting?


Solution

  • You can use the Windows Multimedia API (also known as WinMM):

    ' From Larry Allen
    ' https://www.knowbrainer.com/forums/forum/messageview.cfm?catid=12&threadid=12153&highlight_key=y&keyword1=eject
    ' http://archive.is/Y2ouS
    ' Tested with Dragon NaturallySpeaking 12.5 with Windows 7 SP1 x64 Ultimate
    Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _
    ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _
    ByVal hWndCallback As Long)
    
    Sub Main
    Dim dummy As String
        mciSendStringA "Set CDAudio Door Open", dummy, 0, 0
    End Sub
    

    source (mirror)