It is currently March 29th, 2024, 1:46 pm

Optical Drive Status Plugin

Share and get help with Plugins and Addons
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Optical Drive Status Plugin

Post by balala »

I don't know if are you still using an optical drive, but me at least (instead of the fact that lately it's increasingly less used), still using one and will for a while. Since the first time I started to use Rainmeter, I always wanted to check the status of my DVD drive, wanting to know if its tray is open or closed and in this last case, if it either has or not a disk inserted. Over the years, I wrote a few skins trying to check this, with more or less succes. The task has been shown to be difficult, until finally I succeeded writing a such plugin: the OpticalDriveStatus, which I present right now.
So, this plugin does two things: checks the status of the drive tray. In plus, if the drive has a disk inserted, it extracts the icon of the drive, if it has one.
The content of the skin package:
  • A skin, which can show the status of your drive (OpticalDriveTray.ini). The skin also can be used to open / close the drive (by clicking the icon of the drive). Also, if a disk is inserted, it'll show the label of it and if it has one, its icon. If the disk has no icon, the skin will show a generic icon, different for data disk and audio CD:
    Image Image Image
    When you're hovering the mouse over the skin, in its right side two buttons will be shown: first will close the skin, while the second will open the Settings.
  • A Settings skin (this will be loaded first time when you install the skin), which can be used to set the letter of the drive you want to use the skin with. In this skin, only the optical drives will be accessible, as a dropdown list (yes, this menu will have so many elements as many optical drives are installed into the system - in most cases, one single). If the drive permit this, you also can set a time to automatically close the tray. This isn't available on most laptops, but it is on desktops:
    Image
  • The plugin itself, in both (x86 and x64) versions.
  • The nircmd.exe file, used to open / close the drive.
  • During its use, the plugin will create an ico file into the temporary folder (%TEMP%). This icon is used by the skin.
The source code of the plugin (written in C++) is also available, on request. If you'd like it, please send me a PM.

In the development of this plugin I got a lot of help from theAzack9. Many thanks to him.

I'd be grateful if you would tell me how this plugin works and if you find it useful. Thanks in advance.


03/09/2017 - Fixed a bug of the Settings skin. The bug was reported by Bekarfel. Many thanks to him.
You do not have the required permissions to view the files attached to this post.
Last edited by balala on March 9th, 2017, 4:55 pm, edited 2 times in total.
User avatar
sephirotess
Posts: 332
Joined: December 8th, 2016, 6:45 am

Re: Optical Drive Status Plugin

Post by sephirotess »

Hi,

I just tried it. The skin recognized my 2 drives, as well as the associated letters. The plugin is a good idea :D. I use very little the player, nevertheless, I still have many games, software and others on CDs (DVDs). So hard to get through it definitely 8-).
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

sephirotess wrote:I just tried it. The skin recognized my 2 drives, as well as the associated letters. The plugin is a good idea :D. I use very little the player, nevertheless, I still have many games, software and others on CDs (DVDs). So hard to get through it definitely 8-).
Thanks for your reply. I'm glad if you like my plugin.
I'm not sure what player are you using very little? The optical drive?
User avatar
sephirotess
Posts: 332
Joined: December 8th, 2016, 6:45 am

Re: Optical Drive Status Plugin

Post by sephirotess »

Yes, the optical. Sorry, I should have specified. In French we say "lecteur" (player) for an optical disc.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

sephirotess wrote:Yes, the optical. Sorry, I should have specified. In French we say "lecteur" (player) for an optical disc.
Ok, I understand. Just suddenly, it confused me.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

Sorry if I'm a little picky... ;-)

I'm trying to use your very interesting plugin, obviously slightly in a different way (well, what do you expect from me?) :sly:

I see you have many results, depending on what kind of disk is inserted (or not) both numerical and in plain text.
Can you please post a list of all the possible results your plugins produces?

I also have some other questions, but, a step at a time.

Thanks.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

fonpaolo wrote:Sorry if I'm a little picky... ;-)
No, you're not! Probably I should post all these explanations in my first post.
fonpaolo wrote:I see you have many results, depending on what kind of disk is inserted (or not) both numerical and in plain text.
Can you please post a list of all the possible results your plugins produces?
Yes, the plugin returns a numeric and a string value.
The numeric value is according to the state of the drive: 0 if the tray is closed and there's no disk inserted, 1 for open tray and 2 for closed tray, with a disk.
The string value can be one of the followings:
  • If there's an inserted disk and this disk has an icon set, the plugin will extract that icon and will return the path of the extracted icon file (this is %TEMP%\Icon.ico, where obviously %TEMP% is the default path of the temporary files).
  • If the disk in the unit has no icon, but has an Autorun.inf file (without the Icon option) the returned string value is NoIcon.
  • If the disk don't has an Autorun.inf file, the returned string is NoAutorun.
  • If there's no disk inserted, the returned string value will be NoDisk.
  • Finally if the drive set by the Drive option of the plugin measure isn't an optical drive (CD, DVD or BluRay), the value will be NoOptical.
My example skin, in second and third case shows a generic disk icon (different if the disk is a data or an Audio CD).
Note that in the code of the plugin measure, you have to set the letter of the drive to want to use the plugin / skin with (as I said, as the Drive option of this measure). If you're using the skin I've posted in my first entry of this thread, the Settings.ini skin will do the needed settings (setting the value of the Drive variable, within the @Resources\Settings.inc file).
fonpaolo wrote:I also have some other questions, but, a step at a time.
Let me know them.

Do you find useful a such plugin? Is it working well?
Thanks for trying it.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

It's useful?
Obviously yes! :thumbup:
I was waiting for something like this for so long.

I'm still experimenting, I'm trying to update one of my skins and probably now I can.

Another question related to your plugin is if there's a way to disable it, tried with Disabled=1 but it's still active.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

balala wrote:...
[*]Finally if the drive set by the Drive option of the plugin measure isn't an optical drive (CD, DVD or BluRay), the value will be NoOptical.
Sorry for the (stupid) question, but I can't imagine* what other kind of media you can insert in a CD/DVD/BluRay reader/writer...

* Well, from my experience, helping some friends, retailers of branded and assembled computers, I can imagine... but I don't think it will match what you had in mind. :sly: ;-)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

fonpaolo wrote:It's useful?
Obviously yes! :thumbup:
I was waiting for something like this for so long.
Thanks for the appreciations.
fonpaolo wrote:Another question related to your plugin is if there's a way to disable it, tried with Disabled=1 but it's still active.
No, it's not, but disabling it can be a bit confusing. Adding the Disabled=1 option to the plugin measure (in my example skin, the [MeasureCDStatus] measure) is disabling it. In this case, the numeric value returned by the plugin will be 0 (a disabled plugin always do so), which means "Tray closed, no media". The skin will indicate this status all the time, no mater what is the real status of the drive.
On the other hand if you add a button with the LeftMouseUpAction=[!ToggleMeasure "MeasureCDStatus"] option, you can disable / enable the plugin measure. In this case, if a disk is inserted and the skin shows this status and the appropriate icon, when you disable it, it'll switch to the "Tray closed, no media" status (0) and the icon will be hidden. When re-enabling the measure, it'll show again the real fact: the "Tray closed, media present" status (2) and the icon of the inserted disk.
fonpaolo wrote:Sorry for the (stupid) question, but I can't imagine* what other kind of media you can insert in a CD/DVD/BluRay reader/writer...

* Well, from my experience, helping some friends, retailers of branded and assembled computers, I can imagine... but I don't think it will match what you had in mind. :sly: ;-)
Probably nothing else could be inserted, but even if it could be, if the Drive option is set properly, the appropriate drive would be an optical drive. The NoOptical message is related to the situation when the Drive option is set to a non-optical drive (let's say a hard disk partition). Eg if your DVD is the drive E: and on the OpticalDriveStatus plugin measure you set Drive=D: (which is a hard disk partition), then the plugin measure will return the NoOptical string value and, according to this situation, my example skin will show the "D: is not an optical drive." message.

I hope I could help. Please feel free to add further questions, if you have any.