Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

List optical drives and store in variable


  • Please log in to reply
5 replies to this topic

#1 am632

am632

    Prodigy

  • Active Members
  • PipPipPip
  • 187 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

    I'm old - what's your excuse?

  • Moderators
  • 21,264 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
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 guinness

guinness

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,238 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()_ConvertLHWebColor()/_ConvertSHWebColor()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#4 am632

am632

    Prodigy

  • Active Members
  • PipPipPip
  • 187 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

    all-consuming swarm in inconspicuous disguise

  • Developers
  • 17,238 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()_ConvertLHWebColor()/_ConvertSHWebColor()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()LockFile()Mapping CtrlIDsParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...
Updated: 30/07/2014


#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