R.L. Posted July 5, 2004 Share Posted July 5, 2004 (edited) Just a small one to play with the open tray function in AutoitIt is designed to open whatever drive letter quickly. By default, it will open D: drive, wait for 10 seconds and then close the tray. Press <Enter> will close the tray early. Press <Insert> will extend another 15 seconds. If a different drive than D: drive is used (e.g., e: drive), one can make a command in the shortcut after the script is complied (e.g., Trayquickie.exe E: ) and it will launch the drive specified. Hence more than one drives can be pointed to by shortcuts.July, 7, 04: NEW CODE UPLOADED http://www.autoitscript.com/fileman/users/public/RL/trayquickie.au3 Edited July 14, 2004 by R.L. R.L.A few pieces made with new GUI enabled AutoIt Link to comment Share on other sites More sharing options...
tuape Posted July 13, 2004 Share Posted July 13, 2004 If $CMDLINE[0]= 0 Then Global $dr = "d:" call ("operation") Else Global $dr = $CMDLINE[1] call ("operation") EndIf Func status() If DriveStatus($dr) = "ready" Then Global $status = "occupied" elseif DriveStatus($dr) = "notready" Then Global $status = "empty" else Global $status = "not read" endif EndFunc Func operation() AutoItSetOption("TrayIconHide",1) call ("status") CDTray($dr, "open") HotKeySet ( "{ENTER}", "close" ) HotKeySet("{insert}", "delay") ToolTip("Tray " & $dr &" was " & $status & "; closes in 10 sec (hit <Enter> to close; <insert> to delay)", 8, 0) sleep(10000) CDTray($dr, "close") EndFunc func delay() ToolTip("Tray " & $dr &" was " & $status & "; closes in 15 sec (hit <Enter> to close; <insert> to delay)", 8, 0) sleep (15000) Call("close") EndFunc Func close() CDTray($dr, "close") exit EndFuncI think you could change this If $CMDLINE[0] = 0 Then Global $dr = "d:" call ("operation") to this: If $CMDLINE[0] = 0 Then Global $dr = DriveGetDrive( "cdrom" ) If NOT @error Then call ("operation") End If .. Link to comment Share on other sites More sharing options...
R.L. Posted July 14, 2004 Author Share Posted July 14, 2004 Thanks. I noticed that error and updated the script (sorry, I should have posted the updated one long ago but have been busy) Now it will give out a "not read" status if the drive is unaccessible due to other programs occupying it But thanks for pointing it out, yours was a nice suggestion, too. Func status() If DriveStatus($dr) = "ready" Then Global $status = "occupied" elseif DriveStatus($dr) = "notready" Then Global $status = "empty" else Global $status = "not read" endif EndFunc RL R.L.A few pieces made with new GUI enabled AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now