It is currently March 28th, 2024, 4:31 pm

Substitute

Get help with creating, editing & fixing problems with skins
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Substitute

Post by Alloutofmercy »

I have these images
Screenshot 2022-01-11 182321.png
I have this
Screenshot 2022-01-11 182411.png
I'd like the images to change every month and indicate the month instead of a string.I used substitute but something is wrong. I am wondering if I have to specify a path for those images even if they are in the resources folder only.
Here is the code:-

Code: Select all

[measureDate]
Measure=Time
Format=%B
UpdateDivider=40
Substitute="1":"Jan1.png","2":"Feb2.png","3":"Mar3.png","4":"Apr4.png","5":"May5.png","6":"June6.png","7":"July7.png","8":"Aug.png","9":"Sep9.png","10":"Oct10.png","11":"Nov.png","12":"Dec12.png"


[month]
Meter=image
measurename=measureDate
X=(-20+[Day:X])
Y=50
DynamicVariables=1
Group=Sliders
Fontface=Die in a fire PG
W=20
H=25





User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Substitute

Post by CodeCode »

To designate the @Resources Folder as the directory of an image the #@# needs to precede the file name.

No \ is necessary it is implied in the rainmeter function. Even if you put the \ there rainmeter actually ignores it anyway.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Substitute

Post by balala »

Alloutofmercy wrote: January 11th, 2022, 1:01 pm I'd like the images to change every month and indicate the month instead of a string.I used substitute but something is wrong. I am wondering if I have to specify a path for those images even if they are in the resources folder only.
For sure. If the images are in the @Resources folder add the folder to the substituted values in the Substitute option of the [measureDate] measure. Something like this: Substitute="1":"#@#Jan1.png","2":"#@#Feb2.png",... (obviously add each month, I just shortened the option).
This way the string returned by the [measureDate] measure are containing the path of the images. Normally if those images are for instance in a folder named Month for example into the @Resources folder, you have to modify the above paths accordingly (if the images are @Resources\Month\Jan1.png - and so on -, use the Substitute="1":"#@#Month\Jan1.png",... option).
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Substitute

Post by Alloutofmercy »

Dosent work still.

Code: Select all

[measureDate]
Measure=Time
Format=%m
UpdateDivider=40
Substitute="1":"#@#Jan1.png","2":"#@#Feb2.png","3":"#@#Mar3.png","4":"#@#Apr4.png","5":"#@#May5.png","6":"#@#June6.png","7":"#@#July7.png","8":"#@#Aug.png","9":"#@#Sep9.png","10":"#@#Oct10.png","11":"#@#Nov.png","12":"#@#Dec12.png"



[month]
Meter=image
measurename=measureDate
X=(-20+[Day:X])
Y=50
AntiAlias=1
DynamicVariables=1
Group=Sliders
Fontface=Die in a fire PG
Fontcolor=255,255,255,255
W=20
H=25
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Substitute

Post by balala »

Alloutofmercy wrote: January 11th, 2022, 2:53 pm Dosent work still.
Make sure you have the images in the appropriate location. They have to be in the @Resources folder. Also check their names: are they named as you've used them in the Substitute option (Jan1.png, Feb2.png and so on)? Check the log. Is there any error message?
If you can't get it to work, please pack the whole config and upload the package, to can check. I need the images as well, beside the code.
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Substitute

Post by Alloutofmercy »

Log is being spammed with error messages. Look
Screenshot (27).png
Screenshot (26).png
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Substitute

Post by eclectic-tech »

Looks like there is a zero 0 as the first character in your Imagename...
ImageName: Unable to open: 0C:\Users\ishaa\Documents\Rainmeter\Skins\Maximalist suite\@Resources\Jan1.png

Look through your code for all ImageName= instances and find the one(s) that have a zero in the name.

BTW, it is not ideal to have 'spaces' in the names of Rainmeter related files, sections, variables, etc.
Spaces may cause unpredictable errors if not handled properly...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Substitute

Post by balala »

eclectic-tech wrote: January 11th, 2022, 6:36 pm Looks like there is a zero 0 as the first character in your Imagename...
ImageName: Unable to open: 0C:\Users\ishaa\Documents\Rainmeter\Skins\Maximalist suite\@Resources\Jan1.png

Look through your code for all ImageName= instances and find the one(s) that have a zero in the name.
Or the substitution is broken. A 0 might be as well for instance this way: Substitute="1":"0#@#Jan1.png","2":"#@#Feb2.png",.... If this is the case, there not even needed to have the 0 on each substitution, just on the current one (on the one related to January).
eclectic-tech wrote: January 11th, 2022, 6:36 pm BTW, it is not ideal to have 'spaces' in the names of Rainmeter related files, sections, variables, etc.
Spaces may cause unpredictable errors if not handled properly...
Right. Even if not forbidden, not a good idea either to use those spaces. They are making the quotes mandatory.
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Substitute

Post by Alloutofmercy »

I cant find any zeroes in the substitution so I rewrote it again. Now the zero is gone from the error message
Screenshot 2022-01-12 142207.png
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Substitute

Post by CodeCode »

What I see from your latest error message capture, is that the skin is not looking in the @Resources folder for each image - instead it is looking for them in the config directory.

So you must choose where you want those images to be. Then either use the #@# prefix if they are in the @Resources folder, or not and the images have been chosen to go in the config folder instead.

If you are still having a problem with this, be sure to do another capture of your log file, to try and avoid confusion.

It really should make more sense, but if you are changing the paths of your files again, and again, then you will continue to get error messages.
Post Reply