Robert_STL

All USB Storage to Dropdown List

3 posts in this topic

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] & "|"
    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.

Share this post


Link to post
Share on other sites

Thanks for your fast reply.

i will try it tomorow.

 

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