Can rainmeter eject a USB?
I was randomly messing with a skin and I wondered if I could add to a skin that on one click it would eject a USB drive.
It is difficult for me to eject with the normal windows ejector, as I have removed the right part of my toolbar. In its place, I have a launcher, which I would like to add an ejector. Is it possible?
It is currently October 4th, 2023, 12:59 pm
Eject USB
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Eject USB
Insert inspirational quote here
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Eject USB
Nativelly not, but a third party app or a plugin might help.Sam12345 wrote: ↑March 20th, 2021, 9:00 pm Can rainmeter eject a USB?
I was randomly messing with a skin and I wondered if I could add to a skin that on one click it would eject a USB drive.
It is difficult for me to eject with the normal windows ejector, as I have removed the right part of my toolbar. In its place, I have a launcher, which I would like to add an ejector. Is it possible?
In the Disks skin of my Mirage, I used the UDisk plugin for this (by cfixd), which is excelent. Previously I tried out some other apps as well, but I'm much more satisfied by this plugin.
If interested, try it out and let us (me) know if questions arise.
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Re: Eject USB
Iv'e been attempting to use this Plugin, but once again, i require your assistance...

This is the code I have so far, but clicking on the image doesn't do anything
Code: Select all
[MeasureUDisk]
Measure=Plugin
Plugin=UDisk
Drive=Removable
Mode=Normal
;-------------------------------------------------------------
;-------------------------------------------------------------
[MeterEjectUSB]
Meter=Image
ImageName=#@#Pictures.png
X=50r
Y=r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!Redraw]
LeftMouseUpAction=[!CommandMeasure MeasureUDisk Remove]

Insert inspirational quote here
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Re: Eject USB
I just noticed, I get this in the error log
You do not have the required permissions to view the files attached to this post.
Insert inspirational quote here
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Eject USB
Replace the LeftMouseUpAction option of the [MeterEjectUSB] meter with the following one: [!CommandMeasure "MeasureUDisk" "Remove_X:"]. Make sure you're using the correct drive letter in the bang.Sam12345 wrote: ↑March 21st, 2021, 8:15 pm Iv'e been attempting to use this Plugin, but once again, i require your assistance...![]()
This is the code I have so far, but clicking on the image doesn't do anythingCode: Select all
[MeasureUDisk] Measure=Plugin Plugin=UDisk Drive=Removable Mode=Normal ;------------------------------------------------------------- ;------------------------------------------------------------- [MeterEjectUSB] Meter=Image ImageName=#@#Pictures.png X=50r Y=r W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!Redraw] LeftMouseUpAction=[!CommandMeasure MeasureUDisk Remove]
The DriveMeasure option has to be added to the child measures, not to the parent measure, which I believe you did. If I'm right, this can indeed cause Rainmeter to crash, because an infinite loop is created.
There might be some erros in your code probably. Post the whole code please.
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Re: Eject USB
I want it to eject all drives, can that be done?
Code: Select all
[Rainmeter]
Update=100
Author=Connect-R, Sam P
;-------------------------------------------------------------
;-------------------------------------------------------------
[MeterBg]
Meter=Shape
X=0
Y=0
AntiAlias=1
;-------------------------------------------------------------
;-------------------------------------------------------------
[styleText1]
style=Text
Font=Segoe UI
FontSize=11
FontWeight=
Fontcolor=255, 255, 255, 255
Center=CenterBottom
;-------------------------------------------------------------
;-------------------------------------------------------------
[MeasureRecycleBin]
Measure=PLUGIN
RecycleType=COUNT
Drives=ALL
[MeasureBinAction]
Measure=Calc
Formula=MeasureRecycleBin
IfAboveAction=! [!HideMeter MeterBinEmpty][!ShowMeter MeterBinFull]
IfAboveValue=0
IfEqualAction=! [!HideMeter MeterBinFull][!ShowMeter MeterBinEmpty]
IfEqualValue=0
[MeasureWiFiPercent]
Measure=PLUGIN
Plugin=WifiStatus.dll
WiFiInfoType=QUALITY
Substitute=" ":""
UpdateDivider=1
[MeasureIconCalc]
Measure=CALC
Formula=((100 >= MeasureWiFiPercent) && (90 <= MeasureWiFiPercent) ? 5 : ((90 > MeasureWiFiPercent) && (60 <= MeasureWiFiPercent) ? 4 : ((60 > MeasureWiFiPercent) && (30 < MeasureWiFiPercent) ? 3 : ((30 >= MeasureWiFiPercent) && (10 < MeasureWiFiPercent) ? 2 : ((MeasureWiFiPercent <= 10) && (0 < MeasureWiFiPercent) ? 1 : 0)))))
UpdateDivider=1
[MeasureUser]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=USER_NAME
[MeasureText]
Measure=String
[MeasureUDisk]
Measure=Plugin
Plugin=UDisk
Drive=Removable
;-------------------------------------------------------------
;-------------------------------------------------------------
300
[MeterText]
Meter=STRING
MeterStyle=styleText1
MeasureName=MeasureText
Text=Sam P
X=0r
Y=4
AntiAlias=1
[MeterMyComputer]
Meter=Image
ImageName=#@#My Computer.png
X=60r
Y=0
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!Redraw]
LeftMouseUpAction=Explorer Shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
[MeterLogOff]
Meter=Image
ImageName=#@#ShutDown.png
X=50r
Y=r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterLogOff ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterLogOff ImageTint 255,255,255][!Redraw]
LeftMouseDoubleClickAction=[rundll32.exe user32.dll,LockWorkStation "run"]
[MeterBinEmpty]
Meter=Image
ImageName=#@#Empty.png
X=50r
Y=r
W=25
Hidden=0
AntiAlias=1
MouseOverAction=[!SetOption MeterBinEmpty ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterBinEmpty ImageTint 255,255,255][!Redraw]
LeftMouseUpAction=! [::{645FF040-5081-101B-9F08-00AA002F954E}]
[MeterBinFull]
Meter=Image
ImageName=#@#Full.png
X=r
Y=r
W=25
Hidden=1
AntiAlias=1
MouseOverAction=[!SetOption MeterBinFull ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterBinFull ImageTint 255,255,255][!Redraw]
RightMouseDownAction=! [! "MeasureRecycleBin EmptyBin"]
LeftMouseUpAction=! [::{645FF040-5081-101B-9F08-00AA002F954E}]
[MeterGoogle]
Meter=Image
ImageName=#@#Google.png
X=50r
Y=r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterGoogle ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterGoogle ImageTint 255,255,255][!Redraw]
LeftMouseUpAction=! ["C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"]
[MeterWiFi]
Meter=Image
MeasureName=MeasureIconCalc
ImageName=#@#/%1.png
X=50r
Y=r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterWiFi ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterWiFi ImageTint 255,255,255][!Redraw]
PreserveAspectRatio=1
DynamicVariables=1
LeftMouseUpAction=!["control.exe" "ncpa.cpl"]
[MeterEjectUSB]
Meter=Image
ImageName=#@#Pictures.png
X=50r
Y=r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!Redraw]
MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!Redraw]
LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "Remove:"]
Insert inspirational quote here
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Eject USB
Of corse. Replace the LeftMouseUpAction option of the [MeterEjectUSB] meter (LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "Remove:"]) with the following one: LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "RemoveDrive"].
I see a few problems in this code:Sam12345 wrote: ↑March 21st, 2021, 9:03 pmCode: Select all
[Rainmeter] Update=100 Author=Connect-R, Sam P ;------------------------------------------------------------- ;------------------------------------------------------------- [MeterBg] Meter=Shape X=0 Y=0 AntiAlias=1 ;------------------------------------------------------------- ;------------------------------------------------------------- [styleText1] style=Text Font=Segoe UI FontSize=11 FontWeight= Fontcolor=255, 255, 255, 255 Center=CenterBottom ;------------------------------------------------------------- ;------------------------------------------------------------- [MeasureRecycleBin] Measure=PLUGIN RecycleType=COUNT Drives=ALL [MeasureBinAction] Measure=Calc Formula=MeasureRecycleBin IfAboveAction=! [!HideMeter MeterBinEmpty][!ShowMeter MeterBinFull] IfAboveValue=0 IfEqualAction=! [!HideMeter MeterBinFull][!ShowMeter MeterBinEmpty] IfEqualValue=0 [MeasureWiFiPercent] Measure=PLUGIN Plugin=WifiStatus.dll WiFiInfoType=QUALITY Substitute=" ":"" UpdateDivider=1 [MeasureIconCalc] Measure=CALC Formula=((100 >= MeasureWiFiPercent) && (90 <= MeasureWiFiPercent) ? 5 : ((90 > MeasureWiFiPercent) && (60 <= MeasureWiFiPercent) ? 4 : ((60 > MeasureWiFiPercent) && (30 < MeasureWiFiPercent) ? 3 : ((30 >= MeasureWiFiPercent) && (10 < MeasureWiFiPercent) ? 2 : ((MeasureWiFiPercent <= 10) && (0 < MeasureWiFiPercent) ? 1 : 0))))) UpdateDivider=1 [MeasureUser] Measure=Plugin Plugin=Plugins\SysInfo.dll SysInfoType=USER_NAME [MeasureText] Measure=String [MeasureUDisk] Measure=Plugin Plugin=UDisk Drive=Removable ;------------------------------------------------------------- ;------------------------------------------------------------- 300 [MeterText] Meter=STRING MeterStyle=styleText1 MeasureName=MeasureText Text=Sam P X=0r Y=4 AntiAlias=1 [MeterMyComputer] Meter=Image ImageName=#@#My Computer.png X=60r Y=0 W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!Redraw] LeftMouseUpAction=Explorer Shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D} [MeterLogOff] Meter=Image ImageName=#@#ShutDown.png X=50r Y=r W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterLogOff ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterLogOff ImageTint 255,255,255][!Redraw] LeftMouseDoubleClickAction=[rundll32.exe user32.dll,LockWorkStation "run"] [MeterBinEmpty] Meter=Image ImageName=#@#Empty.png X=50r Y=r W=25 Hidden=0 AntiAlias=1 MouseOverAction=[!SetOption MeterBinEmpty ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterBinEmpty ImageTint 255,255,255][!Redraw] LeftMouseUpAction=! [::{645FF040-5081-101B-9F08-00AA002F954E}] [MeterBinFull] Meter=Image ImageName=#@#Full.png X=r Y=r W=25 Hidden=1 AntiAlias=1 MouseOverAction=[!SetOption MeterBinFull ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterBinFull ImageTint 255,255,255][!Redraw] RightMouseDownAction=! [! "MeasureRecycleBin EmptyBin"] LeftMouseUpAction=! [::{645FF040-5081-101B-9F08-00AA002F954E}] [MeterGoogle] Meter=Image ImageName=#@#Google.png X=50r Y=r W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterGoogle ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterGoogle ImageTint 255,255,255][!Redraw] LeftMouseUpAction=! ["C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"] [MeterWiFi] Meter=Image MeasureName=MeasureIconCalc ImageName=#@#/%1.png X=50r Y=r W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterWiFi ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterWiFi ImageTint 255,255,255][!Redraw] PreserveAspectRatio=1 DynamicVariables=1 LeftMouseUpAction=!["control.exe" "ncpa.cpl"] [MeterEjectUSB] Meter=Image ImageName=#@#Pictures.png X=50r Y=r W=25 AntiAlias=1 MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!Redraw] LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "Remove:"]
- Remove the orphan exclmation marks, from options like IfAboveAction and IfEqualAction of the [MeasureBinAction] measure
(IfAboveAction=! [!HideMeter MeterBinEmpty][!ShowMeter MeterBinFull] and IfEqualAction=! [!HideMeter MeterBinFull][!ShowMeter MeterBinEmpty]), because they are not needed and in fact are preventing the options in which are they used, to work. They are causing the Invalid bang: ! error mesaages in the log, which can be seen on the image you've posted previously. Such exclamation marks are existing in more places (on meters like [MeasureBinAction], [MeterBinEmpty], [MeterBinFull] and[MeterGoogle]), you should remove all of them. - The [MeasureText] measure (which has a single Measure=String option, without any other), seems completely useless.
- The [MeasureRecycleBin] measure is missing the Plugin= option and as such, it causes an error message in the log. Add back the missing Plugin=RecycleManager option. Additionally note that even if it indeed was a plugin, in meantime RecycleManager became a measure, so you could replace the Measure=Plugin and the missing Plugin=RecycleManager options with the single Measure=RecycleManager option.
- The MouseOverAction and MouseLeaveAction options of meters like [MeterMyComputer], [MeterLogOff], [MeterBinEmpty], [MeterBinFull], [MeterGoogle], [MeterWiFi] or [MeterEjectUSB] are missing, an otherwise needed, [!UpdateMeter "MeterMyComputer"] bang. These options were looking initially this way (I'm posting here only the options of the [MeterMyComputer] meter, but the other ones are the same):
Correctly and completely, these options should look this way:
Code: Select all
[MeterMyComputer] ... MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!Redraw]
See the added [!UpdateMeter "MeterMyComputer"] bangs in both options. Without them, the [!Redraw] bang are completely useless, because redrawing the skin, without updating the appropriate meter (in this case [MeterMyComputer]), is useless, or even harmful, executing a bang, which makes no sense without an update.Code: Select all
[MeterMyComputer] ... MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!UpdateMeter "MeterMyComputer"][!Redraw] MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!UpdateMeter "MeterMyComputer"][!Redraw]
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Re: Eject USB
Thanks

I was editing the code and I saw that using something like !action ir something wasn't needed, when removing them I must have left the ! in.balala wrote: ↑March 22nd, 2021, 8:43 pm I see a few problems in this code:
- Remove the orphan exclmation marks, from options like IfAboveAction and IfEqualAction of the [MeasureBinAction] measure
(IfAboveAction=! [!HideMeter MeterBinEmpty][!ShowMeter MeterBinFull] and IfEqualAction=! [!HideMeter MeterBinFull][!ShowMeter MeterBinEmpty]), because they are not needed and in fact are preventing the options in which are they used, to work. They are causing the Invalid bang: ! error mesaages in the log, which can be seen on the image you've posted previously. Such exclamation marks are existing in more places (on meters like [MeasureBinAction], [MeterBinEmpty], [MeterBinFull] and[MeterGoogle]), you should remove all of them.

A relic of some code I was experimenting with... I forgot to remove the whole thing - thanks for pointing it out

The original code was last updated in 2018 as far as I can tell, probably before it became a measurebalala wrote: ↑March 22nd, 2021, 8:43 pm [*]The [MeasureRecycleBin] measure is missing the Plugin= option and as such, it causes an error message in the log. Add back the missing Plugin=RecycleManager option. Additionally note that even if it indeed was a plugin, in meantime RecycleManager became a measure, so you could replace the Measure=Plugin and the missing Plugin=RecycleManager options with the single Measure=RecycleManager option.
I done it, but I don't see much differencebalala wrote: ↑March 22nd, 2021, 8:43 pm [*]The MouseOverAction and MouseLeaveAction options of meters like [MeterMyComputer], [MeterLogOff], [MeterBinEmpty], [MeterBinFull], [MeterGoogle], [MeterWiFi] or [MeterEjectUSB] are missing, an otherwise needed, [!UpdateMeter "MeterMyComputer"] bang. These options were looking initially this way (I'm posting here only the options of the [MeterMyComputer] meter, but the other ones are the same):Correctly and completely, these options should look this way:Code: Select all
[MeterMyComputer] ... MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!Redraw] MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!Redraw]
See the added [!UpdateMeter "MeterMyComputer"] bangs in both options. Without them, the [!Redraw] bang are completely useless, because redrawing the skin, without updating the appropriate meter (in this case [MeterMyComputer]), is useless, or even harmful, executing a bang, which makes no sense without an update.[/list]Code: Select all
[MeterMyComputer] ... MouseOverAction=[!SetOption MeterMyComputer ImageTint 255,255,255,100][!UpdateMeter "MeterMyComputer"][!Redraw] MouseLeaveAction=[!SetOption MeterMyComputer ImageTint 255,255,255][!UpdateMeter "MeterMyComputer"][!Redraw]

Thanks for your help!


PS. What do you use to to make symbols for rainmeter skins?

Insert inspirational quote here
-
- Rainmeter Sage
- Posts: 15689
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Eject USB
Did it work?
It happens, but the problem is that the remaining exclamation mark cause the options not to work and add error messages in the log.
Doesn't matter, you can use it as a plugin, but don't forget to add the Plugin=RecycleManager option.
The difference is that the meter is updated immediately, it doesn't wait the next update cycle to update. Indeed don't really see a difference, but as said !Redraw alone, without !UpdateMeter (or !ShowMeter / !HideMeter) doesn't make too much sense.
What kind of symbols are you talking about?
Additional question: why do you update the skin ten times per second (using the Update=100 option in the [Rainmeter] section). There is nothing (at least as far as I can say), which justifys this. I think the default Update=1000 would be perfect in this case.
-
- Posts: 80
- Joined: February 27th, 2021, 9:41 pm
- Location: London
Re: Eject USB
Yup, thanks

I thought it felt snappier, but I told my self it was my imagination

For example, I want to create an image for the USB ejector as the one now isn't good. I could just download a photo of the internet and resize it, but I want to make one that matches the rest of the skin.


Insert inspirational quote here