It is currently January 22nd, 2022, 4:49 am

Meter Image for Month name

Help with creating, editing & fixing problems with skins
Yuvrajjj
Posts: 2
Joined: January 6th, 2022, 10:36 am

Meter Image for Month name

Post by Yuvrajjj »

Hi!

I want the month to be displayed in abbreviated form, my problem is since I couldn't find a desired small font, I made images of month names myself :D , but I don't know the right code to show up those images in the widget, can anyone share the code please?

Thanks.
User avatar
death.crafter
Rainmeter Sage
Posts: 1293
Joined: April 24th, 2021, 8:13 pm

Re: Meter Image for Month name

Post by death.crafter »

Yuvrajjj wrote: January 6th, 2022, 10:46 am Hi!

I want the month to be displayed in abbreviated form, my problem is since I couldn't find a desired small font, I made images of month names myself :D , but I don't know the right code to show up those images in the widget, can anyone share the code please?

Thanks.

Code: Select all

[MeasureWeekday]
Measure=Time
Format=%a
[MeterWeekday]
Meter=Image
MeasureName=MeasureWeekday
ImageName=path\to\images\%1.png
; Here %1 will be replaced by Sun, Mon, Tue, etc
; So just replace image path by your image folder
; and name your images as sun.png, mon.png, tue.png, etc.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Meter Image for Month name

Post by balala »

death.crafter wrote: January 6th, 2022, 12:49 pm

Code: Select all

[MeasureWeekday]
Measure=Time
Format=%a
[MeterWeekday]
Meter=Image
MeasureName=MeasureWeekday
ImageName=path\to\images\%1.png
; Here %1 will be replaced by Sun, Mon, Tue, etc
; So just replace image path by your image folder
; and name your images as sun.png, mon.png, tue.png, etc.
Even if this does work (and it does), I tend not to use the MeasureName and the ImageName options together in the same Image meter. See the Note here.
That's why I'd better use a substitution on the [MeasureWeekday] measure, to get it returning the whole path of the appropriate image. In some cases this could be a not too good approach, for instance if the value returned by the measure has to be used in other parts of the skin as well. However I believe it worth taking into account such a possibility.
An example:

Code: Select all

[MeasureWeekday]
Measure=Time
Format=%a
RegExpSubstitute=1
Substitute="^(.*)$":"path\to\images\\1"

[MeterWeekday]
Meter=Image
MeasureName=MeasureWeekday
;ImageName=#@#%1.png
; Here %1 will be replaced by Sun, Mon, Tue, etc
; So just replace image path by your image folder
; and name your images as sun.png, mon.png, tue.png, etc.
See that in this case I added a RegExpSubstitute and a Substitute option to the [MeasureWeekday] measure, in order to get it returning the full image path, not just the name. In parallel I also removed the ImageName option from the [MeterWeekday] meter. It's not needed anymore.
However as said, your approach does work as well.
User avatar
death.crafter
Rainmeter Sage
Posts: 1293
Joined: April 24th, 2021, 8:13 pm

Re: Meter Image for Month name

Post by death.crafter »

balala wrote: January 6th, 2022, 5:00 pm Even if this does work (and it does), I tend not to use the MeasureName and the ImageName options together in the same Image meter. See the Note here.
That's why I'd better use a substitution on the [MeasureWeekday] measure, to get it returning the whole path of the appropriate image. In some cases this could be a not too good approach, for instance if the value returned by the measure has to be used in other parts of the skin as well. However I believe it worth taking into account such a possibility.
I would say it's just over complication.

ImageName is overridden by MeasureName only if Measure has an extension, which is not so in the case.

I guess they could check for image existence and decide more wisely as to what to use, but that's beyond our point of discussion.

But then again that's just me ;-)
from the Realm of Death
Yuvrajjj
Posts: 2
Joined: January 6th, 2022, 10:36 am

Re: Meter Image for Month name

Post by Yuvrajjj »

working :thumbup:
Image

Thanks everyone.