Jump to content
c.haslam

Get capability of empty CD/DVD drive

Recommended Posts

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

 

Share this post


Link to post
Share on other sites

image.thumb.png.f0230d58fc0d8a2d85c50e2254107582.png

 

Sorry for the circles i just wake up ;p


My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

as i said i was just waking up :P 

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 by caramen

My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

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 : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

@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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Why not extract the cmd result...?


My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@c.haslam

Post the code you are running :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
#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 by caramen

My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 by caramen

My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

@c.haslam
From this code, what it's returned from the Caption property? :)
 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites
StringInStr ( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] )

 

xD


My video tutorials : HERE ( 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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

×
×
  • Create New...