Jump to content



Photo

List optical drives and store in variable


  • Please log in to reply
5 replies to this topic

#1 am632

am632

    Adventurer

  • Active Members
  • PipPip
  • 148 posts

Posted 06 March 2011 - 02:40 PM

Hi,

Can someone help me, I basically want a combobox that displays a list of optical drives (or just the burners if possible) and if one is selected then it will store it in a variable.

does anyone know how 2 do this?

thanks







#2 Melba23

Melba23

    Yes, me!

  • Moderators
  • 15,749 posts

Posted 06 March 2011 - 02:52 PM

am632,

Try using the Search function - I remember seeing a UDF out there somewhere which identifies burner drives. :)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
RecFileListToArray- An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items

#3 guinness

guinness

    guinness

  • MVPs
  • 11,050 posts

Posted 06 March 2011 - 03:02 PM

This is how add to a ComboBox (no error checking added) for your reference. Plus have a look at _WinAPI_GetDriveType() in WinAPIEx.au3 by Yashied.
AutoIt         
_Main() Func _Main()     Local $iCombo, $aDrive, $sDriveData = "Please Select A Drive..." & "|", $sRead     GUICreate("Optical Drives", 210, 60)     $iCombo = GUICtrlCreateCombo("", 5, 5)     $iButton = GUICtrlCreateButton("Select", 140, 32.5, 65, 20)     $aDrive = DriveGetDrive("CDROM")     For $i = 1 To $aDrive[0]         $sDriveData &= StringUpper($aDrive[$i]) & "\" & "|"     Next     GUICtrlSetData($iCombo, $sDriveData, "Please Select A Drive...")     GUISetState(@SW_SHOW)     While 1         Switch GUIGetMsg()             Case -3                 Exit             Case $iButton                 $sRead = GUICtrlRead($iCombo)                 If $sRead == "Please Select A Drive..." Then                     MsgBox(16, "You Selected", "Please Select A Drive.")                 Else                     MsgBox(16, "You Selected", $sRead)                 EndIf         EndSwitch     WEnd EndFunc   ;==>_Main

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#4 am632

am632

    Adventurer

  • Active Members
  • PipPip
  • 148 posts

Posted 06 March 2011 - 03:06 PM

HI, thanks for the replys, your example is gr8, and i have just downloaded the udf which looks very useful

#5 guinness

guinness

    guinness

  • MVPs
  • 11,050 posts

Posted 06 March 2011 - 03:08 PM

Function:
#include <Constants.au3> MsgBox($MB_SYSTEMMODAL, '', 'The media type of the E:\ drive is: ' & _GetDriveMediaType('E:')) Func _GetDriveMediaType($sDrive)     Local $oWMIService = ObjGet('winmgmts:\\.\root\cimv2')     Local $oColItems = $oWMIService.ExecQuery('Select * From Win32_CDROMDrive Where Drive = "' & StringLeft($sDrive, 2) & '"', 'WQL', 0x30), $sReturn = ''     If IsObj($oColItems) Then         For $oObjectItem In $oColItems             $sReturn &= $oObjectItem.MediaType         Next     EndIf     Return SetError($sReturn = '', 0, $sReturn) EndFunc   ;==>_GetDriveMediaType

Edited by guinness, 09 April 2013 - 04:22 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#6 engjcowi

engjcowi

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 28 May 2011 - 02:01 PM

Looks useful thanks
Drunken Frat-Boy Monkey Garbage




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users