Jump to content

CD Tray opening script (my frist script in AutoIt)


N30N3M3S1S
 Share

Recommended Posts

Here is the first creation I have made in AutoIt. Its a remake of a console I redefined in C++, I remade it in AutoIt as a program to use on my mIRC or whatever use I come to it. Ready to compile and run :) Made to be assigned to a hotkey in the Fkey row.

#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

Also here is the alias I use to make work with mIRC. pressing F5 in mIRC makes it launch the program. (After compiling above snippet, compile as CDTray.exe and place in the mIRC directory if you want to use it with your mIRC too.)

alias F5 { run CDTray.exe }

Simple, eh?

Edited by N30N3M3S1S
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...