Jump to content

Recommended Posts

Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

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