James Posted August 27, 2007 Share Posted August 27, 2007 Hey all, I have the following which will retrieve removable devices: Global $io_type Func GetDevices($io_type) ;~ This function will get all USB devices and list them MsgBox(0, "AUSB", "AUSB will now load your USB devices." & @CRLF & "This may take some time!", 3) For $a = 1 To $io_type[0] $DriveLabel = DriveGetLabel($io_type[$a]) GUICtrlSetData($USBDevices, StringUpper($io_type[$a]) & "\") Next GUISetState(@SW_SHOW) EndFunc ;==>GetDevices Unfortunatley it also returns the A:\ drive. How can I ony get USB devices? -James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
weaponx Posted August 27, 2007 Share Posted August 27, 2007 DriveGetLabel requires a file path be sent to it, what is in your $io_type array? Link to comment Share on other sites More sharing options...
James Posted August 27, 2007 Author Share Posted August 27, 2007 Global $Devices = DriveGetDrive("REMOVABLE") ;~ We need to get all Removable devices GetDevices($Devices) Func GetDevices($io_type) ;~ This function will get all USB devices and list them MsgBox(0, "AUSB", "AUSB will now load your USB devices." & @CRLF & "This may take some time!", 3) For $a = 1 To $io_type[0] $DriveLabel = DriveGetLabel($io_type[$a]) GUICtrlSetData($USBDevices, StringUpper($io_type[$a]) & "\") Next GUISetState(@SW_SHOW) EndFunc ;==>GetDevices Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
weaponx Posted August 27, 2007 Share Posted August 27, 2007 Option 1: #include Global $Devices = DriveGetDrive("REMOVABLE") ;~ We need to get all Removable devices $RESULT = _ArraySearch ( $Devices, "a:") If NOT @ERROR Then _ArrayDelete($Devices[$RESULT]) GetDevices($Devices) Func GetDevices($io_type) ;~ This function will get all USB devices and list them MsgBox(0, "AUSB", "AUSB will now load your USB devices." & @CRLF & "This may take some time!", 3) For $a = 1 To $io_type[0] $DriveLabel = DriveGetLabel($io_type[$a]) GUICtrlSetData($USBDevices, StringUpper($io_type[$a]) & "\") Next GUISetState(@SW_SHOW) EndFunc ;==>GetDevicesoÝ÷ Øêmöjëh×6#include Global $Devices = DriveGetDrive("REMOVABLE") ;~ We need to get all Removable devices GetDevices($Devices) Func GetDevices($io_type) ;~ This function will get all USB devices and list them MsgBox(0, "AUSB", "AUSB will now load your USB devices." & @CRLF & "This may take some time!", 3) For $a = 1 To $io_type[0] If $io_type[$a] <> "a:" Then $DriveLabel = DriveGetLabel($io_type[$a]) GUICtrlSetData($USBDevices, StringUpper($io_type[$a]) & "\") EndIf Next GUISetState(@SW_SHOW) EndFunc ;==>GetDevices Link to comment Share on other sites More sharing options...
James Posted August 27, 2007 Author Share Posted August 27, 2007 (edited) 2nd Option! So much faster too! Thanks weaponx! Edited August 27, 2007 by JamesB Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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