Building on the approach from my previous post, here's a working version:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
---Meters---
[TestImage]
Meter=Image
X=-32
Y=-32
ImageName=#@#a.png
[DefaultImage]
Hidden=(([TestImage:W]>0) && ([TestImage:H]>0))
Meter=Image
W=32
H=32
ImageName=#@#c.png
[ActualImage]
Hidden=(([TestImage:W]=0) && ([TestImage:H]=0))
Meter=Image
W=32
H=32
ImageName=#@#a.png
These are, as before, based on my own "test" images (I don't have album images for my tracks, I don't use those), so they should probably adapted to your own scenario. The idea is that:
- the invisible (due to the appropriate negative coordinates, not supported by Rainmeter) test image meter tries to load the actual (album) image
- the default image meter is hidden if the test image meter's dimensions are greater than 0, i.e. if the image exists, otherwise shown
- the actual image meter is hidden if the test image meter's dimensions are equal to 0, i.e. if the image doesn't exist, otherwise shown
This follows a similar principle to the
Total option of the FreeDiskSpace measure, which can be used to test if a drive / partition exists since if it doesn't its value is 0. Here, the "out of view" test image meter is used to check if the image file exists by checking the meter's dimensions against 0 values. Naturally, while the other image meters can have their W and H set, the test image meter should not, in order to be able to tell if it's "populated" or not by checking its dimensions. Also, its X and Y should be adjusted to the appropriate negative values so that it is entirely out of the skin area (or out of view).
Of course, in your scenario, a bit of care should be taken on the matter of updating the meters, generally doing it only when needed. I won't tailor this to your example today, as it's a bit late where I live and I'm in the mood for some relax time, but tomrrow, if you don't figure out how to adapt it by then, I'll do it.
Or, you can wait for balala to tell you how to fix the Lua variant. Your choice.
P.S. The test image can be made "invisible" by placing it into a transparent Container meter as well, but of course, doing it by setting its coordinates to negative values is simpler.