It is currently January 23rd, 2022, 8:43 am

Optical Drive Status Plugin

Share and get help with Plugins and Addons
User avatar
fonpaolo
Moderator
Posts: 1388
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

Ok, balala, another question, trying to understand how you're using the plugin in your skin...

Code: Select all

[MeasureCDStatus]
Measure=Plugin
Plugin=OpticalDriveStatus
Drive=#Drive#
IfMatch=NoIcon|NoAutorun
IfMatchAction=[!SetVariable NoIcon "1"][!UpdateMeasure "MeasureCDIcon"]
IfNotMatchAction=[!SetVariable NoIcon "0"][!UpdateMeasure "MeasureCDIcon"]

[MeasureCDIcon]
Measure=Calc
Formula=(( [MeasureCDStatus:] <= 1 ) ? [MeasureCDStatus:] : (( #Audio# = 1 ) ? 2 : (( #NoIcon# = 1 ) ? 3 : 4 )))
IfCondition=(MeasureCDIcon=0)
IfTrueAction=[!SetOption MeterIcon ImageName ""]... [!SetOption MeterDrive Text "Tray closed,#CRLF#no media."][!SetOption MeterTray ImageName "#@#Closed.png"]...
IfCondition2=(MeasureCDIcon=1)
IfTrueAction2=[!SetOption MeterIcon ImageName ""]... [!SetOption MeterDrive Text "Tray open."][!SetOption MeterTray ImageName "#@#Open.png"]...
IfCondition3=(MeasureCDIcon=2)
IfTrueAction3=[!SetOption MeterIcon ImageName "#@#AudioCD.png"]... [!SetOption MeterDrive Text "Tray closed,#CRLF#media present."][!SetOption MeterTray ImageName "#@#Closed.png"]...
IfCondition4=(MeasureCDIcon=3)
IfTrueAction4=[!SetOption MeterIcon ImageName "#@#Disk.png"]... [!SetOption MeterDrive Text "Tray closed,#CRLF#media present."][!SetOption MeterTray ImageName "#@#Closed.png"]...
IfCondition5=(MeasureCDIcon=4)
IfTrueAction5=[!SetOption MeterIcon ImageName "[*MeasureCDStatus*]"]... [!SetOption MeterDrive Text "Tray closed,#CRLF#media present."][!SetOption MeterTray ImageName "#@#Closed.png"]...
IfCondition6=(MeasureCDIcon=-1)
IfTrueAction6=[!SetOption MeterIcon ImageName ""]... [!SetOption MeterDrive Text "#Drive# is not ready."]...
IfCondition7=(MeasureCDIcon=-2)
IfTrueAction7=[!SetOption MeterIcon ImageName ""]... [!SetOption MeterDrive Text "#Drive# is not an optical drive."]...
IfCondition8=(MeasureCDIcon=-3)
IfTrueAction8=[!SetOption MeterIcon ImageName ""]... [!SetOption MeterDrive Text "#Drive# Error."]...
DynamicVariables=1
I posted only the relevant parts, this makes me think there are more than 0, 1 and 2 as numeric values, if I'm not wrong.

edit: it doesn't matter, I don't think to display so much informations anyway.
User avatar
balala
Rainmeter Sage
Posts: 13721
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

fonpaolo wrote:I posted only the relevant parts, this makes me think there are more than 0, 1 and 2 as numeric values, if I'm not wrong.

edit: it doesn't matter, I don't think to display so much informations anyway.
But it does matter, I'd be happy if you would understand what I wanted to do.
So, the numeric value returned by the [MeasureCDStatus] plugin measure can be either 0, 1 or 2 (nothing else). The formula of the [MeasureCDIcon] calc measure (which isn't the plugin measure!) checks if the numeric value of the [MeasureCDStatus] measure ([MeasureCDStatus:]) is less or equal with 1 (if it's less, the tray is closed, but has no disk inserted, while if it's 1, the tray is open). In this cases, the value of the [MeasureCDIcon] measure will be equal with the numeric value of the [MeasureCDStatus] measure (the icon will be hidden). Otherwise if a disk is inserted into the drive (so [MeasureCDStatus:] is equal with 2), should be checked if the inserted disk is an audio CD (which will have a different icon) or a data disk. In this last case also should be checked if it has a set icon. If it doesn't has, the skin will have to show a generic icon, otherwise the icon of the disk (extracted by the plugin). According to the Formula of the [MeasureCDIcon] measure, if the disk is an audio CD, the measure will return 2 (in this case the Audio variable is equal with 1 - this is set by the [MeasureLabel] measure), otherwise if the disk doesn't has an icon set, it'll return 3 (the [MeasureCDStatus] measure sets the NoIcon variable), while if the plugin has extracted and wrote the icon, the [MeasureCDIcon] measure will return 4.
According to the returned value, the appropriate action is executed.
User avatar
fonpaolo
Moderator
Posts: 1388
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

Well, actually I've already understood the math behind the measure simply playing with your plugin. ;-)

I've to give you a big thanks, with your plugin I finally have the opportunity to get rid of the program I was using.
Really a great plugin. :D :thumbup:
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4586
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Optical Drive Status Plugin

Post by eclectic-tech »

fonpaolo wrote:Well, actually I've already understood the math behind the measure simply playing with your plugin. ;-)

I've to give you a big thanks, with your plugin I finally have the opportunity to get rid of the program I was using.
Really a great plugin. :D :thumbup:
Great job balala! :thumbup:

No issues using your plugin, and the skin you created looks good in the corner of my desktop! :D !

Thanks! :great:
User avatar
fonpaolo
Moderator
Posts: 1388
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

There's only a little problem, but it's not related with your plugin, when you insert a disk, Rainmeter hangs until the disk is read, a well known issue.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Optical Drive Status Plugin

Post by mak_kawa »

Hi balala.

This is a great plugin... I, too, am an optical drive user both at my office and home. For me, it is still necessary for secondary data back-up destination. So, I have a self-made tiny skin to manage and monitor it using VBS (see attached image).

But my skin has not such functions as your skin at all; judgement of media inserted or not, auto-close tray, and so on.

From now, I will try to integrate the functions to my skin using your plugin. Thanks.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 13721
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

eclectic-tech wrote:Great job balala! :thumbup:

No issues using your plugin, and the skin you created looks good in the corner of my desktop! :D !

Thanks! :great:
You're welcome. Also many thanks for your appreciations. Means a lot.
User avatar
balala
Rainmeter Sage
Posts: 13721
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

fonpaolo wrote:Well, actually I've already understood the math behind the measure simply playing with your plugin. ;-)

I've to give you a big thanks, with your plugin I finally have the opportunity to get rid of the program I was using.
Really a great plugin. :D :thumbup:
I'm really glad if you think so. As I also replied to eclectic-tech too, many thanks for your appreciations. They also mean a lot for me.
fonpaolo wrote:There's only a little problem, but it's not related with your plugin, when you insert a disk, Rainmeter hangs until the disk is read, a well known issue.
Yeah, I know about this. But as you also said, that's something about how the optical drives are working and there's nothing to do with it. It seems that as long as we're using such disks, we have to live with it.
Last edited by balala on February 4th, 2017, 2:47 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 13721
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Optical Drive Status Plugin

Post by balala »

mak_kawa wrote:Hi balala.

This is a great plugin... I, too, am an optical drive user both at my office and home. For me, it is still necessary for secondary data back-up destination. So, I have a self-made tiny skin to manage and monitor it using VBS (see attached image).

But my skin has not such functions as your skin at all; judgement of media inserted or not, auto-close tray, and so on.

From now, I will try to integrate the functions to my skin using your plugin. Thanks.
I'm also regularly using my DVD drive, I presume I won't stop using it, at least not for a while from now. Because of this and due to the fact that I couldn't find something similar, I finally decided last year to write a such plugin.
Feel free to integrate it, I hope you'll succeed. Just please let me know if you have questions.
User avatar
fonpaolo
Moderator
Posts: 1388
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Optical Drive Status Plugin

Post by fonpaolo »

Some more testing of your plugin, it's exactly what I was waiting for.
Only a minor question: does it support UpdateDivider?

I'm experiencing some little more cpu usage if it's running, and I'm using an UpdateDivider=10, the other measures and meters have UpdateDivider=-1. :confused: