It is currently March 29th, 2024, 10:03 am

Disk Drive Label won't show up sometimes

Get help with creating, editing & fixing problems with skins
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Disk Drive Label won't show up sometimes

Post by pul53dr1v3r »

Hi all. I'm making a feature of Disk Drive skin so that it show Label of the disk. Done all, but sometimes when I connect a removable drive, it doesn't show label (until I move the mouse over the skin), and sometimes it does(without moving mouse over it). The same happening when I disconnect the drive, the label (if firstly showed) wont dissapear until I move my mouse over it.
Looks like a refresh issue, but so far I haven't found the solution.

Here is a part of the code:

Code: Select all

Update=1000

[styleTitle]
StringAlign=CENTER
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[meterTitle]
Meter=STRING
MeterStyle=styleTitle
X=104
Y=12
W=197
H=48
Text= [MeasureDiskLabel] (#HD1#)
LeftMouseUpAction=!Execute ["#HD1#\"]
DynamicVariables=1
MouseOverAction=[!SetOption meterTitle FontColor #ColorR#] [!SetOption "meterTitle" "Text" "OPEN"] [!UpdateMeter meterTitle][!Redraw]
MouseLeaveAction=[!SetOption meterTitle FontColor #colorText#] [!SetOption "meterTitle" "Text"  "[MeasureDiskLabel] (#HD1#)"] [!UpdateMeter meterTitle][!Redraw]

[MeasureDiskLabel]
Measure=FreeDiskSpace
Drive=F:
Label=1
IgnoreRemovable=0

Last edited by pul53dr1v3r on September 21st, 2017, 8:04 pm, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Disk Drive Label won't show up sometimes

Post by mak_kawa »

To escape replacement by section variable, the second action in MouseLeaveAction should be written as [!SetOption "meterTitle" "Text" "[*MeasureDiskLabel*] (#HD1#)"]?

Following code does work for me.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Variables]
HD1=F:

[MeasureDiskLabel]
Measure=FreeDiskSpace
Drive=#HD1#
Label=1
IgnoreRemovable=0

[meterTitle]
Meter=STRING
X=104
Y=12
W=197
H=48
Text= [MeasureDiskLabel] (#HD1#)
LeftMouseUpAction=["#HD1#\"]
DynamicVariables=1
MouseOverAction=[!SetOption "meterTitle" "Text" "OPEN"] [!UpdateMeter meterTitle][!Redraw]
MouseLeaveAction=[!SetOption "meterTitle" "Text" "[*MeasureDiskLabel*] (#HD1#)"] [!UpdateMeter meterTitle][!Redraw]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Disk Drive Label won't show up sometimes

Post by balala »

Beside mak_kawa's good reply (which I think fix the problem), be careful to not use the !Execute bang, because it's deprecated (you've used it in the LeftMouseUpAction option of the [meterTitle] meter). mak_kawa also removed it in his code.
Don't get me wrong, this has nothing to do with your initial question, just I saw it and wanted to clarify this detail.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Disk Drive Label won't show up sometimes

Post by pul53dr1v3r »

No guys, the only thing it does is color change. The issue still exist. In the meantime, I've figured out how the issue appears.
After refresh, until you move mouse over the Label-Title, it works Ok, but after mouse move over it, the Label stucks. When I did Refresh it worked well again, but after only one mouse move over the Label, stucks again...
So, the issue is the mouse moving over the Label and it stucks the skin to show up things correcty, when the drive is in or out.
On the video I'm inserting a stick into my PC all the time, Labels "Used" and "Total" show correctly when the Stick is in or out.

[Youtube]
https://youtu.be/vVZ554DsjTY
[/Youtube]

Here is the skin in rmskin format:
http://www24.zippyshare.com/v/iKXJwED0/file.html
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Disk Drive Label won't show up sometimes

Post by balala »

Two ways to fix the issue:
  • First of all, usually we don't add to a string meter the value returned by a measure as you did (Text=[MeasureDiskLabel] (#HD1#) on the [meterTitle] meter), but adding it through a MeasureName option. So, add the MeasureName=MeasureDiskLabel option to the [meterTitle] meter and replace its Text option with the following one: Text=%1 (#HD1#). In this case also replace the MouseLeaveAction option of the same [meterTitle] meter with the following one: MouseLeaveAction=[!SetOption "meterTitle" "Text" "[color=#FF0000]%1[/color] (#HD1#)"][!UpdateMeter meterTitle][!Redraw] (marked with red what I've changed).
  • If you don't want to use the above described method, you just have to replace the same MouseLeaveAction option of the [meterTitle] meter, this time with the following one: MouseLeaveAction= [!SetOption "meterTitle" "Text" "[[color=#FF0000]*[/color]MeasureDiskLabel[color=#FF0000]*[/color]] (#HD1#)"] [!UpdateMeter meterTitle][!Redraw].
Although doesn't matter which methode will you use, I'd prefere the first one. It seems much simpler, in my opinion. But any of them will work (I hope). Let me (us) know which one did you use.
Also don't forget to remove the !Execute bang (see above, in my previous reply)
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Disk Drive Label won't show up sometimes

Post by pul53dr1v3r »

Thx! Both of the methods have been implemented and are working like a charm. "!Execute" removed as well. That's it as far as this issue is concerned.
I'm like you about method choice. The first one is a way easier.

There is one more thing about the Colors mentioned by mak_kawa. That method work very well for me, but if there is a better one, I'd be glad to use it.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Disk Drive Label won't show up sometimes

Post by balala »

Pul53dr1v3r wrote:Both of the methods have been implemented and are working like a charm.
I'm glad if you got them working well. Otherwise mak_kawa also mentioned in his reply the need of escaping the section variable, which I didn't see when I read it (sorry mak_kawa). See his first paragraph above. You also can read this.
Pul53dr1v3r wrote:"!Execute" removed as well. That's it as far as this issue is concerned.
No, it's not, as I said. Even if deprecated, !Execute still can be used. Rainmeter is always backwards compatibile, that's why !Execute still works, even a few years after it was deprecated. But it's not a good habit to use it on newer codes.
Pul53dr1v3r wrote:There is one more thing about the Colors mentioned by mak_kawa. That method work very well for me, but if there is a better one, I'd be glad to use it.
To be honest, I don't see what mak_kawa mentioned about the colors. But the way you've done it in your first request, is good and works. Just one minor thing you have to keep in mind: color codes are strings, even if they contan only three (or in some cases four) numbers. As such, always is a good idea to include them into quotations (don't misunderstand, even the simple numbers is good to be included, even more the strings):

Code: Select all

[meterTitle]
...
MouseOverAction=[!SetOption meterTitle FontColor "#ColorR#"][!SetOption meterTitle Text "OPEN"][!UpdateMeter "meterTitle"][!Redraw]
MouseLeaveAction=[!SetOption meterTitle FontColor "#colorText#"][!SetOption meterTitle Text "%1 (#HD1#)"] [!UpdateMeter "meterTitle"][!Redraw]
I also got used to include the names of the meters in the !UpdateMeter bangs, into quotations (see above).
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Disk Drive Label won't show up sometimes

Post by pul53dr1v3r »

thank you for the support and useful advices. That's it about this issue. Have got one more about the skin with full orange bar when no device connected, but it's for a new topic.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Disk Drive Label won't show up sometimes

Post by balala »

Pul53dr1v3r wrote:thank you for the support and useful advices. That's it about this issue. Have got one more about the skin with full orange bar when no device connected, but it's for a new topic.
Probably a properly created !SetOption bang could help, but I also think there will be needed some more and new measures.
Post your request and we'll see...