wi1d 0 Report post Posted November 27, 2005 (edited) I'm wanting to populate a combo box with drives that are available to map to. So I have to somehow minus all drives that are already in use. I've racked my brain and search the site and haven't come up with anything besides possible creating an array to list A: - Z: and then using DriveGetDrive() and to compare the two to find what drives are available. However I'm sure there has to be a better way and was wondering if anyone has a suggestion. Thanks. Edited November 27, 2005 by wi1d Share this post Link to post Share on other sites
Jos 1,291 Report post Posted November 27, 2005 (edited) Something like: Dim $AllDrives For $x = 1 to 26 $AllDrives = $AllDrives & "|" & chr(96+$x) & ":" Next $var = DriveGetDrive( "all" ) If NOT @error Then For $i = 1 to $var[0] $AllDrives = StringReplace($AllDrives,"|" & $var[$i],"") Next EndIf and use $AllDrives in your Combobox Edited November 27, 2005 by JdeB Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files How to post scriptsource Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
CyberSlug 3 Report post Posted November 27, 2005 (edited) @JdeB: That's hard to follow.... I'm pretty sure that DriveStatus will do what you want. The message box is included to help debug.... $debug = "Drive" & @TAB & "Status" & @TAB & @TAB & "GetType" & @TAB & "MapGet" & @LF $debug = $debug & "------" & @TAB & "-------" & @TAB & @TAB & "-------" & @TAB & "-------" $list = "" For $i = Asc("B") to Asc("Z") $drive = Chr($i) & ":" If DriveStatus($drive) = "INVALID" Then $list = $list & $drive & "|" $debug = $debug & @LF & $drive & @TAB & DriveStatus($drive) & @TAB & @TAB & DriveGetType($drive) & @TAB & DriveMapGet($drive) Next #include <GuiConstants.au3> GuiCreate("Example", -1, -1, 100, 100);change default posotion $combo = GuiCtrlCreateCombo("",50, 50, 100, 200, $CBS_DROPDOWNLIST) $defaultSelection = StringLeft($list,StringInStr($list,":"));the first drive letter $infoButton = GuiCtrlCreateButton("Debug", 200, 100, 100, 50) GuiCtrlSetData($combo, $list, $defaultSelection) GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $infoButton Then MsgBox(4096,"For Debugging", $debug) WEnd Edit: Improved example. Edited November 27, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Share this post Link to post Share on other sites
wi1d 0 Report post Posted November 28, 2005 Thanks for both examples. I really liked your use of Asc, Chr, w/ the loop. Great stuff, I wouldn't have thought of that. Thanks again. Share this post Link to post Share on other sites