It is currently March 28th, 2024, 10:46 pm

Using Udisk Plugin for tooltip

Get help with creating, editing & fixing problems with skins
User avatar
Sam12345
Posts: 80
Joined: February 27th, 2021, 9:41 pm
Location: London

Using Udisk Plugin for tooltip

Post by Sam12345 »

Hi... once again :twisted: :oops:
I want a tooltip to show one thing if I have drives connected, and another if I have no drives.
This is the code I made:

Code: Select all

[MeterEjectUSB]
Meter=Image
ImageName=#@#Eject USB.png
W=20
H=18
X=50r
Y=3r
W=25
AntiAlias=1
PreserveAspectRatio=0
MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!SetOption MeterEjectUSB W90 H90 PreserveAspectRatio=0][!UpdateMeter "MeterEjectUSB"][!Redraw]
MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!UpdateMeter "MeterEjectUSB"][!Redraw]
LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "RemoveDrive"]
ToolTipTitle=Eject USB
IfCondition=MeasureUDisk > 1
IfTrueAction=[!SetOption "MeterEjectUSB" "ToolTipText" "Drives ready to be ejected"]
IfFalseAction=[!SetOption "MeterEjectUSB" "ToolTipText" "No attached drives"]
Nothing comes up, but when I add a ToolTipText , it works, meaning that the IfCondition is wrong... I believe. But I cant see what?
Insert inspirational quote here
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Using Udisk Plugin for tooltip

Post by balala »

Sam12345 wrote: April 2nd, 2021, 2:34 pm Nothing comes up, but when I add a ToolTipText , it works, meaning that the IfCondition is wrong... I believe. But I cant see what?
For sure it is. IfConditions can't be used on meter, they have to be added to a measure. So for first try moving the IfCondition / IfTrueAction / IfFalseAction options to a measure, for instance to the [MeasureUDisk] measure.
User avatar
Sam12345
Posts: 80
Joined: February 27th, 2021, 9:41 pm
Location: London

Re: Using Udisk Plugin for tooltip

Post by Sam12345 »

balala wrote: April 2nd, 2021, 4:19 pm IfConditions can't be used on meter, they have to be added to a measure
I forgot that :?

It worked for a few seconds, and than I got this in the error log
Screenshot 2021-04-05 144759.png
I suppose its the Ejector, as now it just shows no USB attached, even when there is.
The thing is, I didn't change anything (besides moving it to Measures, but it worked after that). I'm posting the code again, JIC.

Code: Select all

[MeasureUDisk]
Measure=Plugin
Plugin=UDisk
Drive=Removable
IfCondition=MeasureUDisk > 1
IfTrueAction=[!SetOption "MeterEjectUSB" "ToolTipText" "Drives ready to be ejected"]
IfFalseAction=[!SetOption "MeterEjectUSB" "ToolTipText" "No attached drives"]
;-------------------------------------------------------------
;-------------------------------------------------------------
[MeterEjectUSB]
Meter=Image
ImageName=#@#Eject USB.png
W=20
H=18
X=50r
Y=3r
W=25
AntiAlias=1
MouseOverAction=[!SetOption MeterEjectUSB ImageTint 255,255,255,100][!SetOption MeterEjectUSB W90 H90 PreserveAspectRatio=0][!UpdateMeter "MeterEjectUSB"][!Redraw]
MouseLeaveAction=[!SetOption MeterEjectUSB ImageTint 255,255,255][!UpdateMeter "MeterEjectUSB"][!Redraw]
LeftMouseUpAction=[!CommandMeasure "MeasureUDisk" "RemoveDrive"]
ToolTipTitle=Eject USB
PreserveAspectRatio=0
You do not have the required permissions to view the files attached to this post.
Insert inspirational quote here
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Using Udisk Plugin for tooltip

Post by eclectic-tech »

You cannot set multiple options in one !SetOption bang; you need to use a separate action bangs for each...
So change the MouseOver/MouseLeave action bangs to something like this:

Code: Select all

MouseOverAction=[!SetOption "MeterEjectUSB" "ImageTint" "255,255,255,100"][!SetOption "MeterEjectUSB" "W" "90"][!SetOption "MeterEjectUSB" "H" "90"][!SetOption "MeterEjectUSB" "PreserveAspectRatio" "0"][!UpdateMeter "MeterEjectUSB"][!Redraw]
MouseLeaveAction=[!SetOption "MeterEjectUSB" "ImageTint" "255,255,255"][!SetOption "MeterEjectUSB" "W" "20"][!SetOption "MeterEjectUSB" "H" "18"][!SetOption "MeterEjectUSB" "PreserveAspectRatio" "1"][!UpdateMeter "MeterEjectUSB"][!Redraw]
This will change the size of the image when the mouse is over, and then set it back to the original size when the mouse leaves.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Using Udisk Plugin for tooltip

Post by balala »

Sam12345 wrote: April 5th, 2021, 1:57 pm It worked for a few seconds, and than I got this in the error log
In addition to eclectic-tech's reply, note that a !Setoption bang always has to have three or four parameters, never more. See the following (otherwise almost correctly used - see below why almost) !SetOption bang, copied from your previous post: [!SetOption MeterEjectUSB ImageTint 255,255,255,100] (this bang is the first bang of the MouseOverAction option of the [MeterEjectUSB] meter)
The parameters are the followings:
  • Meter/Measure - Name of the section (only a meter or a measure can be used here, Rainmeter for instance can't be - see the What !SetOption can change and what it can't section here) where you do want to set something with the !SetOption bang (in your bang this is MeterEjectUSB).
  • Option - Name of the option you want to update with the bang (ImageTint in your case).
  • Value - The value which you want to assign to the option (for you this is 255,255,255,100).
  • Config - an optional parameter, which can be, but it's not always set - If you want to set an option onto another skin / config than the current one (in which are you using the !SetOption bang), you have to add this parameter, which tells Rainmeter in which config it has to set the option value given by the previous parameters.
The reason why I said previously that the above !SetOption bang which I quoted is not entirely correct (or complet), even if it does work is that it's always a good idea to get used to add quotes around the value you want to set with the bang. Even if in this case for instance, the posted form does work, as said, does worth to form a behavior by adding those quotes. The most correct and complete form of this bang would be: [!SetOption MeterEjectUSB ImageTint "255,255,255"]. See the quotes around the color code. Here is a short explanation.
User avatar
Sam12345
Posts: 80
Joined: February 27th, 2021, 9:41 pm
Location: London

Re: Using Udisk Plugin for tooltip

Post by Sam12345 »

eclectic-tech wrote: April 5th, 2021, 4:51 pm This will change the size of the image
I'd actually forgotten I was trying to do this, I'm leaving it for now, so I deleted it. Probably will re add it, hopefully with smooth transitions, at some point in the future.
balala wrote: April 5th, 2021, 5:49 pm The most correct and complete form of this bang would be
Done. :great:

No errors in the log anymore, but the tooltip still doesn't work. :confused:

Edit: I plugged the USB in, checked the tooltip, and it wasn't there. 10 minutes later, I came back and it was working. So I took it out, put it back in, refreshed the skin, and it doesn't work. Getting a little confused :(
Insert inspirational quote here
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Using Udisk Plugin for tooltip

Post by eclectic-tech »

Sam12345 wrote: April 5th, 2021, 9:16 pm No errors in the log anymore, but the tooltip still doesn't work. :confused:

Edit: I plugged the USB in, checked the tooltip, and it wasn't there. 10 minutes later, I came back and it was working. So I took it out, put it back in, refreshed the skin, and it doesn't work. Getting a little confused :(
I modified your condition test to be true if the value is greater than OR equal to 1.
It is also a good habit to update the meter and redraw after setting a new option:

Code: Select all

[MeasureUDisk]
Measure=Plugin
Plugin=UDisk
Drive=Removable
IfCondition=MeasureUDisk >= 1
IfTrueAction=[!SetOption "MeterEjectUSB" "ToolTipText" "Drives ready to be ejected"][!UpdateMeter "MeterEjectUSB"][!Redraw]
IfFalseAction=[!SetOption "MeterEjectUSB" "ToolTipText" "No attached drives"][!UpdateMeter "MeterEjectUSB"][!Redraw]
The reason you want to update and redraw after changing the option is that the meter will be accurate immediately. Normally skin default to update every second (default is Update=1000), but if you set Update in [Rainmeter] to something else, it will not update and redraw the changed meter until the entire skin updates.
User avatar
Sam12345
Posts: 80
Joined: February 27th, 2021, 9:41 pm
Location: London

Re: Using Udisk Plugin for tooltip

Post by Sam12345 »

eclectic-tech wrote: April 6th, 2021, 2:15 am I modified your condition test to be true if the value is greater than OR equal to 1.
:oops: Ofc, didn't think of that... it works now :rosegift: thanks. (That also explains why it worked once, I had two drives in at that time)
eclectic-tech wrote: April 6th, 2021, 2:15 am It is also a good habit to update the meter

OK, makes sense
Insert inspirational quote here