Oh, I see - let me think of a solution, as for sure there is one...
![Confused :???:](./images/smilies/bw.gif)
Oh, I see - let me think of a solution, as for sure there is one...
Good point. Didn't noticed this, but you probably are right, especially if it does work for the OP as well. So, congratulations.Yincognito wrote: ↑November 2nd, 2020, 3:32 pm Just tested now your variant, based on a slightly modified code without the UpdateDivider=-1 as suggested, and django933 is right, it doesn't work - the image stays the default one. It's NOT the encoding though (that's certain, as I converted both the script and the INI to UCS-2 LE BOM), it's the wrong syntax in the inline Lua call (can't believe I'm lecturing on Lua syntax now - must be something wrong with me today, LOL) - it should be:
IfCondition=([&MeasureImageLua:file_exists('[&[#CURRENTSECTION]]')]=0)
instead of the original:
IfCondition=([&MeasureImageLua:file_exists('#CURRENTSECTION#')]=0)
That's because of the nested syntax when using similar Lua inline calls, as shown and explained in the simple sample here, coupled with the fact that the #CURRENTSECTION# variable is used as well.
No problem - glad to help. Any idea why the square brackets (actually, mostly [) yield an error if used in inline Lua (or, in this case, in the path)? For example:
A while ago there has been such a question (and if I'm not mistaken a solution, as well) here on the forum. But unfortunately I don't know exactly when and what the solution was. I'm gonna try immediately to find it, but I'm not sure I'll succeed. If I won't, probably sooner or later a solution will arise here, so recommend to wait a little bit.Yincognito wrote: ↑November 2nd, 2020, 6:46 pm No problem - glad to help. Any idea why the square brackets (actually, mostly [) yield an error if used in inline Lua (or, in this case, in the path)? For example:
IfCondition=([&MeasureImageLua:file_exists('C:\blabla\image.png')]=0)
works fine, but:
IfCondition=([&MeasureImageLua:file_exists('C:\bla[bla\image.png')]=0)
yields an error?
I couldn't figure this out, and I tried all kinds of escaping sequences for the [ character, including using Unicode character references.![]()
Not sure if you refer to this one, but found this from moshi and jsmorley (not related to Lua though). Unfortunately, it's not applicable to this scenario, since using different characters will also make the process not refer to the exact same path.balala wrote: ↑November 2nd, 2020, 7:01 pm A while ago there has been such a question (and if I'm not mistaken a solution, as well) here on the forum. But unfortunately I don't know exactly when and what the solution was. I'm gonna try immediately to find it, but I'm not sure I'll succeed. If I won't, probably sooner or later a solution will arise here, so recommend to wait a little bit.
No, not this. I gave a try as well in meantime, and found this, but I feel this is not either. Hoping someone who knows a solution will come to post it soon. In meantime if the code does work, even with error messages, I think it's alright, at least partially.Yincognito wrote: ↑November 2nd, 2020, 7:26 pm Not sure if you refer to this one, but found this from moshi and jsmorley (not related to Lua though). Unfortunately, it's not applicable to this scenario, since using different characters will also make the process not refer to the exact same path.
From what I noticed though, the error doesn't seem to affect the result in the skin, unless the OP has a different experience with this. So, in the end, it might be just a minor inconvenient. In any case, my other solution using negative coordinates is available, just in case.
Well, I believe in that post kyriakos876 tried to say the same as I do: there isn't a good way to escape the square brackets in an inline Lua. Or, there may be just a parser thing. Oh and yeah, where is that "someone" (jsmorley cough cough jsmorleybalala wrote: ↑November 2nd, 2020, 7:42 pm No, not this. I gave a try as well in meantime, and found this, but I feel this is not either. Hoping someone who knows a solution will come to post it soon. In meantime if the code does work, even with error messages, I think it's alright, at least partially.
Code: Select all
[Variables]
[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1
---Measures---
[mPlayer]
Measure=NowPlaying
PlayerName=Winamp
PlayerType=Title
DisableLeadingZero=0
[mAlbum]
Measure=NowPlaying
PlayerName=[mPlayer]
PlayerType=File
RegExpSubstitute=1
Substitute="^(.*\\).*$":"\1image.png"
OnChangeAction=[!UpdateMeterGroup ImagesGroup][!Redraw]
DynamicVariables=1
---Meters---
[MeterTest]
Group=ImagesGroup
Meter=Image
MeasureName=mAlbum
X=-9999
Y=-9999
DynamicVariables=1
OnUpdateAction=[!Log "W = [MeterTest:W]"]
[MeterDefault]
Group=ImagesGroup
Hidden=([MeterTest:W]>0)
Meter=Image
ImageName=default.png
X=0
Y=0
W=500
H=500
DynamicVariables=1
[MeterImage]
Group=ImagesGroup
Hidden=([MeterTest:W]=0)
Meter=Image
MeasureName=mAlbum
X=0
Y=0
W=500
H=500
DynamicVariables=1
To get the size of an image you could use the ImageSize plugin. It can read the size of the image, without having to add it to an Image meter.Yincognito wrote: ↑November 2nd, 2020, 9:09 pm Ok, first I will post the code that checks for the image meter dimensions to see if the image exists or not, i.e. the one using negative coordinates like I explained earlier. This code should work, but it doesn't, despite being logically correct, at least the way I see it:
Thanks for the suggestion, but does one need to use a plugin for every little bit of functionality out there, especially when that functionality exists already? Or, if the plugins are really useful and efficient, why not including them in the standard Rainmeter distribution instead of having to hunt them through the many pages of the forum?balala wrote: ↑November 2nd, 2020, 9:29 pm To get the size of an image you could use the ImageSize plugin. It can read the size of the image, without having to add it to an Image meter.