Jump to content

All USB Storage to Dropdown List


Robert_STL
 Share

Recommended Posts

Here is some script that will retrieve the list of USB storage devices. Just GUICtrlSetData to set the list to your dropdown.

#include <AutoItConstants.au3>
#include <Array.au3>
Local $usbList = ""
$aRemDrives = DriveGetDrive("ALL")
If IsArray($aRemDrives) Then
    For $i = 1 To $aRemDrives[0]
        $driveType = DriveGetType($aRemDrives[$i], 3)
        If StringInStr($driveType, "USB") Then $usbList &= $aRemDrives[$i] & "|"
    Next
EndIf
If $usbList <> "" Then
    While StringRight($usbList, 1) = "|"
        $usbList = StringTrimRight($usbList, 1)
    WEnd
    MsgBox(0, "USB List" , $usbList)
Else
    MsgBox(0, "Warning", "No USB Drives found.")
EndIf

Note that using DriveGetDrive("ALL") is important as not all USB devices show up as removable.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...