Jump to content

All USB Storage to Dropdown List

Recommended Posts


Hi guys.


I need help with the DriveGetDrive("REMOVABLE") function.

Can anybody help to get all USB storage devices listed to a dropdown menue for picking it up one device and open a specified .txt file???

i am confused..

Sorry for my bad english.

Share this post

Link to post
Share on other sites

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] & "|"
If $usbList <> "" Then
    While StringRight($usbList, 1) = "|"
        $usbList = StringTrimRight($usbList, 1)
    MsgBox(0, "USB List" , $usbList)
    MsgBox(0, "Warning", "No USB Drives found.")

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

Share this post

Link to post
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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.