CD-Tray Opener (v2)

By N3M3S1S on Feb 25, 2011

A simple GUI script made with AutoIt (derived from my C++ snippet) ready to compile and run. This script was made to be assigned to a hot key or short cut.

#include <GUIConstantsEx.au3>

$drives = DriveGetDrive("CDROM")
If Not @error Then
    CDTray("" & $drives[1], "open")
    $driveopen = $drives[1]
    Opt("GUIOnEventMode", 1)
    $mwin = GUICreate("CD Tray", 340, 80)
    GUISetOnEvent($GUI_EVENT_CLOSE, "CloseIt")
    GUICtrlCreateLabel("CD Drive '" & $driveopen & "' is now open. Please place/remove disk and click OK.", 10, 10)
    $okb = GUICtrlCreateButton("OK", 125, 45, 80, 23)
    GUICtrlSetOnEvent($okb, "CloseIt")
    GUISetState(@SW_SHOW)
EndIf

While 1
    Sleep(1000)
WEnd

Func CloseIt()
    CDTray("" & $drives[1], "close")
    Exit
EndFunc

Comments

Sign in to comment.
N3M3S1S   -  Mar 01, 2011

Cool :)

 Respond  
Hawkee   -  Feb 26, 2011

There was a problem with our syntax highlighter, so I upgraded to the latest version and it looks like things are fixed.

 Respond  
N3M3S1S   -  Feb 25, 2011

Erm what? Page glitch... dont use this snippet until the page gets fixed...

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.