BrettF Posted May 9, 2010 Posted May 9, 2010 Slightly different take... Still uses the same basic concept expandcollapse popup#include <Misc.au3> ;False = Beep, True = Play Sound $sound = True ;Visible $show_error = True $dlist = _ListDrives() While 1 Sleep(100) If _IsPressed("a5") <> 1 Then ; test if the AltGR key is not pressed. This test avoids that the program executes the function detect() when this key is pressed because AltGR => ctrl +alt (it's not always true but in our case it is) If _IsPressed("11") Then ; test if the Ctrl key is pressed If _IsPressed("12") Then ;test if the alt key is pressed _CheckDrives() EndIf EndIf EndIf WEnd Func _CheckDrives() $c = 0 $a = DriveGetDrive("REMOVABLE") If Not @error Then $c += $a[0] $b = DriveGetDrive("CDROM") If Not @error Then $c += $b[0] If $c > $dlist[0] Then $dlist = _ListDrives() For $i = 1 To $dlist[0] If DriveStatus($dlist[$i] & "\") = "READY" Then If $sound = True Then SoundPlay(@WindowsDir & "\media\tada.wav", 1) Else For $i = 1 To 10 Beep(500, 200) Sleep(20) Next EndIf If $show_error Then MsgBox (0, "Check Drive", "Please check drive """ & $dlist[$I] & """ for media.") EndIf Next EndFunc ;==>_CheckDrives Func _ListDrives() Local $big_array[1], $count = 1 $cds = DriveGetDrive("CDROM") If Not @error Then ReDim $big_array[UBound($big_array) + $cds[0]] For $i = 1 To $cds[0] $big_array[$count] = $cds[$i] $count += 1 Next EndIf $cds = DriveGetDrive("REMOVABLE") If Not @error Then ReDim $big_array[UBound($big_array) + $cds[0]] For $i = 1 To $cds[0] $big_array[$count] = $cds[$i] $count += 1 Next EndIf $big_array[0] = $count - 1 Return $big_array EndFunc ;==>_ListDrives Maybe a little faster? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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