Jump to content
Sign in to follow this  

CD Tray opening script (my frist script in AutoIt)

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")

While 1

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

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

Share this post

Link to post
Share on other sites

see _WinAPI_EjectMedia function in


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post

Link to post
Share on other sites

Rather than saying "good job" he's showing you the already completed coding that someone else did lol. Not bad for a first project.

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.