c.haslam Posted October 3, 2018 Share Posted October 3, 2018 How can get the label of an empty CD/DVD drive? i.e. what shows in Explorer when there is no disc in the drive. I know that _WinAPI_GetCDType() returns the type of disc that is in a CD/DVD drive, but this is not what I need. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
caramen Posted October 3, 2018 Share Posted October 3, 2018 Sorry for the circles i just wake up ;p My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
spudw2k Posted October 3, 2018 Share Posted October 3, 2018 Have you tried DriveGetLabel() FrancescoDiMuro 1 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
c.haslam Posted October 3, 2018 Author Share Posted October 3, 2018 My experience is that DriveGetLabel() only works if the DriveStatus() is READY. A CD drive with no CD in it is not READY so DriveGetabel() returns ''. Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
caramen Posted October 3, 2018 Share Posted October 3, 2018 (edited) as i said i was just waking up Sorry for my misinterpretation of capability with capacity You can do that with: StringRegExp Same way as my first reply... Even _StringBetween & Select & Case I dont know a more easy way with autoit. But... With command line, that is able to be done with autoIT... You can do this ;Open a console then type: wmic logicaldisk get name ;Press Enter and you will see the list of Drives. ;You can also use the following parameter: wmic logicaldisk get caption ;List Drives in Command Prompt 2 ;Using the following will display Device ID and label: wmic logicaldisk get deviceid, volumename, description ;Fsutil tool fsutil fsinfo drives ;It will show mapped drives too. ;Diskpart tool diskpart ;Next use the following command: list volume You got multiple way to do it...And then Get the label inside a Value with a lot of way too Edited October 3, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 3, 2018 Share Posted October 3, 2018 @c.haslam What is the goal of your script? You want to retrieve the Label of the CD-ROM, or you want to know if there is a CD-ROM inserted in the CD-ROM drive of your PC? Because the title of your thread says a thing, and you are saying another thing. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted October 3, 2018 Share Posted October 3, 2018 I was gonna ask same but after his answer i understood that he just need the label of an empty reader.... becose DriveGetLabel() return an empty string @c.haslam ? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
c.haslam Posted October 6, 2018 Author Share Posted October 6, 2018 caramen, you are correct: I need the label that Computer shows when there is no CD/DVD in the drive. On my test PC, I see BD-ROM Drive (D:) FileSelectFolder('xx','') shows the same thing. But on another PC (an older one?) something different probably shows. My script should show whatever any PC shows, so I don't want to hard-code BD-ROM Drive (D:). Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 6, 2018 Share Posted October 6, 2018 @c.haslam Since Drive* functions are not getting what you want, here a little workaround for your request: Global $objWMI, _ $strWMI_Query = "", _ $objWMI_QueryResult, _ $objWMI_Item $objWMI = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2") If IsObj($objWMI) Then $strWMI_Query = "SELECT Availability, Caption, Description, DeviceID, Drive, Name, Status, SystemName, VolumeName, VolumeSerialNumber FROM Win32_CDROMDrive" $objWMI_QueryResult = $objWMI.ExecQuery($strWMI_Query, "WQL") For $objWMI_Item In $objWMI_QueryResult ConsoleWrite("Availability: " & $objWMI_Item.Availability & @CRLF & _ "Caption: " & $objWMI_Item.Caption & @CRLF & _ "Description: " & $objWMI_Item.Description & @CRLF & _ "DeviceID: " & $objWMI_Item.DeviceID & @CRLF & _ "Drive: " & $objWMI_Item.Drive & @CRLF & _ "Name: " & $objWMI_Item.Name & @CRLF & _ "Status: " & $objWMI_Item.Status & @CRLF & _ "SystemName: " & $objWMI_Item.SystemName & @CRLF & _ "VolumeSerialNumber: " & $objWMI_Item.VolumeSerialNumber & @CRLF) Next $objWMI = 0 $objWMI_QueryResult = 0 $objWMI_Item = 0 EndIf Take a look to Win32_CDROMDrive for other information Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
c.haslam Posted October 6, 2018 Author Share Posted October 6, 2018 Thank you. I have tried ConsoleWriting all of the properties, but none show BD-ROM Drive per se. Strange! Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
caramen Posted October 7, 2018 Share Posted October 7, 2018 Why not extract the cmd result...? My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 7, 2018 Share Posted October 7, 2018 (edited) @c.haslam Post the code you are running Edited October 7, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
caramen Posted October 7, 2018 Share Posted October 7, 2018 (edited) #include <Constants.au3> Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get name" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Global $cData = "" While 1 $line = StdoutRead($cDisk) If @error Then ExitLoop $cData &= $line WEnd MsgBox (0,"",""&$cData) Edited October 7, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
caramen Posted October 7, 2018 Share Posted October 7, 2018 (edited) Bit improved... #include <Constants.au3> #include <Array.au3> ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get name" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get caption" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $cDisk = Run(@ComSpec & " /c wmic logicaldisk get deviceid, volumename, description" , @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Global $cData = "" While 1 $line = StdoutRead($cDisk) If @error Then ExitLoop $cData &= $line WEnd MsgBox (0,"",""&$cData) $cSplitedData = StringSplit ($cData,@CRLF) $cStripedData = StringStripCR ( $cData ) $cSplitedStripedData = StringSplit ($cStripedData,@CRLF) I let you do the rest ;p Edited October 7, 2018 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
c.haslam Posted October 8, 2018 Author Share Posted October 8, 2018 On my PC, this identifies D: as CD-ROM Disc, not BD-ROM Drive Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
c.haslam Posted October 8, 2018 Author Share Posted October 8, 2018 The example for _WinAPI_GetCDType() returns "no media" Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
Earthshine Posted October 8, 2018 Share Posted October 8, 2018 and you have not posted any code. you should know better. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted October 8, 2018 Share Posted October 8, 2018 @c.haslam From this code, what it's returned from the Caption property? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
c.haslam Posted October 9, 2018 Author Share Posted October 9, 2018 Francesco, Availability: 3 Caption: HL-DT-ST BDDVDRW UH12NS29 ATA Device Description: CD-ROM Drive DeviceID: IDE\CDROMHL-DT-ST_BDDVDRW_UH12NS29_______________1.00____\5&3A0C046F&0&1.0.0 Drive: D: Name: HL-DT-ST BDDVDRW UH12NS29 ATA Device Status: OK SystemName: MOLLY VolumeSerialNumber: Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
caramen Posted October 9, 2018 Share Posted October 9, 2018 StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] ) xD My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now