Copy & Paste the first lot of code into a text editor and save as EjectB.ahk
Save the second group of line into EjectB.ini (same folder).
Run it; it'll appear in the tray area.
;;; Cd Eject Button v0.2 bLisTeRinG 2004 #Persistent ver = v0.2 bLisTeRinG 2004 drIni = %A_ScriptDir%\EjectB.ini if %0% <> 0 { drive = %1% } Else { iniread, drive, %drIni%, options, CdDrive, } iniread, drTTC, %drIni%, options, TimeToCheck, iniread, drTTO, %drIni%, options, TimeToOpen, iniread, drHot, %drIni%, options, HotKey, iniread, ico, %drIni%, options, IconFile, iniread, ic, %drIni%, options, IconNumber, If drTTC = , drTTC = 1000 If drTTO = , drTTO = 16000 If drHot = , drHot = n If ico = , ico = c:\windows\system\shell32.dll If ic = , ic = 12 If 2 NotContains Tray { Goto drEject } Menu, Tray, Icon, %ico%, %ic% Menu, Tray, nostandard Menu, Tray, add, &Tray InOut, drEject Menu, Tray, default, &Tray InOut Menu, Tray, add, &Explore, drExplore Menu, Config, add, Auto&Play, drPlay Menu, Config, add, Auto&Open, drOpen Menu, Config, add, &Hotkey (Win+Up), drKey Menu, Config, add, &Refresh, drChk Menu, Config, add, &Help, drHelp Menu, Tray, add, Config,:Config Menu, Tray, add, Menu, Tray, add, E&xit, drExit GoSub, drChk GoSub, drKey%drHot% If 3 Contains Boot { Return } drEject: timmy = %A_TickCount% EnvAdd, timmy, %drTTC%, Drive, Eject,%drive%, If timmy > %A_TickCount% { Drive, Eject,%drive%, 1 If drOpen = 95000000 GoSub, drRun } If 2 Contains Tray { Return } drExit: ExitApp Return ;;;;;;;;;;;;;;;;;;;;;;;;; Routines drChk: RegRead, drPlay, HKCR, audiocd\shell RegRead, drOpen, HKCU, Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, NoDriveTypeAutoRun ;msgbox, drOpen %drOpen% If drPlay = play { Menu, Config, Check, Auto&Play } Else { Menu, ConfigConfig, Uncheck, Auto&Play } If drOpen = 95000000 { Menu, Config, Check, Auto&Open } Else { Menu, Config, Uncheck, Auto&Open } Return drExplore: Run, %windir%\explorer.exe %drive%\ Return drHelp: MsgBox, `tCd Eject Button`n%a_space% %ver%`n`nDouble click to Open/Close Cd tray.`n`nx:\EjectB.exe [y]]]`n`nx:`tThe path to EjectB.exe`ny:`tThe Cd drive (ie F:)`nTray:`tLoad a Tray Button`nBoot:`tDon't eject -just load the button Return drKey: If drHot = y { GoSub, drKeyn } Else { GoSub, drKeyy } iniwrite, %drHot%, %drIni%, options, HotKey Return drKeyn: drHot = n Menu, Config, Uncheck, &Hotkey (Win+Up) Hotkey, #numpadup, drEject Hotkey, #numpadup, off Return drKeyy: drHot = y Menu, Config, Check, &Hotkey (Win+Up) Hotkey, #numpadup, drEject Hotkey, #numpadup, on Return drOpen: If drOpen = B5000000 { drOpen = 95000000 Menu, Tray, Check, Auto&Open } Else { drOpen = B5000000 Menu, Tray, Uncheck, Auto&Open } RegWrite, REG_BINARY, HKCU, Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, NoDriveTypeAutoRun, %drOpen% Return drPlay: If drPlay = play { drPlay = Menu, Tray, Uncheck, Auto&Play } Else { drPlay = play Menu, Tray, Check, Auto&Play } RegWrite, REG_SZ, HKCR, audiocd\shell, , %drPlay% Return drRun: Sleep, %drTTO% IfExist, %drive%\Autorun.inf { Return ; msgbox, Autorun.inf Found } IfExist, %drive%\*.cda { Return } IfExist, %drive%\*.* { GoSub, drExplore Return } Return ; add dir-menu?
And here's the initialisation file...
[options] TimeToCheck=1000 TimeToOpen=16000 HotKey=n CdDrive=F: IconFile=c:\windows\system\shell32.dll IconNumber=12