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

Detecting Disk Drive State & Functions on Shutdown

Get help with creating, editing & fixing problems with skins
Spec
Posts: 2
Joined: October 10th, 2017, 11:49 pm

Detecting Disk Drive State & Functions on Shutdown

Post by Spec »

Hi new user here. I've been trying to play a sound whenever my disk drive is opened or when I turn off my computer. I've managed to get the audio to play, but I haven't been able to figure out how to detect anything about the disk drive or shutting down my computer.

I was wondering if rm can even give me that type of information or would I have to use a plugin instead?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Detecting Disk Drive State & Functions on Shutdown

Post by balala »

Spec wrote:I've been trying to play a sound whenever my disk drive is opened
What kind of disk drive are you talking about? An optical drive, as CD / DVD?
Spec wrote:when I turn off my computer.
Rainmeter can't know when the computer is shut down, but it knows when a skin is unloaded. If you have a very simple skin loaded and you don't unload it (maybe it can have nothing visible), when you shutdown the computer, the above skin is unloaded and you can create an option to play the sound in this case. Are you interested into a such solution?
Spec
Posts: 2
Joined: October 10th, 2017, 11:49 pm

Re: Detecting Disk Drive State & Functions on Shutdown

Post by Spec »

balala wrote:What kind of disk drive are you talking about? An optical drive, as CD / DVD?
An optical drive yes.
balala wrote: Rainmeter can't know when the computer is shut down, but it knows when a skin is unloaded. If you have a very simple skin loaded and you don't unload it (maybe it can have nothing visible), when you shutdown the computer, the above skin is unloaded and you can create an option to play the sound in this case. Are you interested into a such solution?
Actually that might be exactly what I need, I'll give you it a whirl.

EDIT: Would I have to use WebParser to check if a skin is unloaded or is Rainmeter able to detect that by itself?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Detecting Disk Drive State & Functions on Shutdown

Post by balala »

Spec wrote:An optical drive yes.
A while ago I wrote a plugin which reads the state of an optical drive. You find it here: https://forum.rainmeter.net/viewtopic.php?p=131992#p131992
The simplest way to get the plugin, is to download and install the skin posted there. Beside the skin, the installer will also install the appropriate version of the plugin, in the right place. If you're interested, just give a try to the skin, to see what it does. If you find it useful, the next step will be to write the code to play the sound, as you wished.
Spec wrote:Actually that might be exactly what I need, I'll give you it a whirl.

EDIT: Would I have to use WebParser to check if a skin is unloaded or is Rainmeter able to detect that by itself?
First try the following code:

Code: Select all

[Rainmeter]
Update=-1
OnCloseAction=[Play "ADD-HERE-THE-NEEDED-WAV-FILE"]

[MeterDumb]
Meter=String
If it's working as you want, we can create another skin, which can detect if this one is loaded and can load it if it's not. A such code indeed will use the WebParser plugin.