Ok so I created an icon skin and I wanted to use it as a tool to cycle through some wallpapers.
The problem is that I don't know much about coding and I'm stuck here, with the option to only set one wallpaper.
Here's the code:
LeftMouseUpAction=[!SetWallpaper "#@#Wallpapers\Forest2.png" Fill]
Can anyone help me?
It is currently March 29th, 2024, 2:05 pm
Icon that sets wallpapers
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Icon that sets wallpapers
I suppose the posted LeftMouseUpAction option works and sets the appropriate wallpaper, right (supposing you have the image in the proper location)?J0wNs wrote:Ok so I created an icon skin and I wanted to use it as a tool to cycle through some wallpapers.
The problem is that I don't know much about coding and I'm stuck here, with the option to only set one wallpaper.
Here's the code:
LeftMouseUpAction=[!SetWallpaper "#@#Wallpapers\Forest2.png" Fill]
How many images have you there, which would have to be set as wallpaper? And what you would like: to set a new wallpaper on every click to the appropriate icon? Please give us a bit more information.
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Icon that sets wallpapers
Right now I have 2 wallpapers, but I'd like to add more in the future. Basically yes, I want with just a click to set the next wallpaper in the folder. I've tried the QuotePlugin but it's all random, and it often sets the wallpaper that's already on, I guess, because sometimes when I click it doesn't change my wallpaper (apparently).
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Icon that sets wallpapers
Ok, if you have a preferred order for the images, do the followings:J0wNs wrote:Right now I have 2 wallpapers, but I'd like to add more in the future. Basically yes, I want with just a click to set the next wallpaper in the folder. I've tried the QuotePlugin but it's all random, and it often sets the wallpaper that's already on, I guess, because sometimes when I click it doesn't change my wallpaper (apparently).
- First create two variables in the [Variables] section. Wallpaper is a variable which controls which image is set as wallapaer, while NumOfWallpapers is the total number of images which you'd like to use:
(add the concrete number of images).
Code: Select all
[Variables] Wallpaper=0 NumOfWallpapers=XX
- Now add the following Calc measure to your code:
Add as many IfCondition / IfTrueAction option pairs, as many are needed, to cover all images you'd like to set as wallpaper.
Code: Select all
[MeasureWallpaper] Measure=Calc Formula=#Wallpaper# IfCondition=(#CURRENTSECTION#=0) IfTrueAction=[!SetWallpaper "#@#Wallpapers\FIRST-WALLPAPER-IMAGE.png" "Fill"] IfCondition2=(#CURRENTSECTION#=1) IfTrueAction2=[!SetWallpaper "#@#Wallpapers\SECOND-WALLPAPER-IMAGE.png" "Fill"] IfCondition3=(#CURRENTSECTION#=2) IfTrueAction3=[!SetWallpaper "#@#Wallpapers\THIRD-WALLPAPER-IMAGE.png" "Fill"] ... DynamicVariables=1
- Finally modify the LeftMouseUpAction of the (probably) Image meter (change the LeftMouseUpAction=[!SetWallpaper "#@#Wallpapers\Forest2.png" Fill] option), as it follows: LeftMouseUpAction=[!SetVariable Wallpaper "((1+#Wallpaper#)%#NumOfWallpapers#)"][!UpdateMeasure "MeasureWallpaper"][!UpdateMeter "#CURRENTSECTION#"]. Also add a DynamicVariables=1 option to this meter, whatever it would be. Make sure to not forget this option, otherwise the skin will change the wallpaper only once.
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Icon that sets wallpapers
Works like a charm, thanks!
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Icon that sets wallpapers
Is there a way to preserve my current wallpaper after I refresh the skin?balala wrote:Great, good job.
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Icon that sets wallpapers
Yep, it is. Just extend the used LeftMouseUpAction, as it follows: LeftMouseUpAction=[color=#FF0000][!WriteKeyValue Variables Wallpaper "((1+#Wallpaper#)%#NumOfWallpapers#)"][/color][!SetVariable Wallpaper "((1+#Wallpaper#)%#NumOfWallpapers#)"][!UpdateMeasure "MeasureWallpaper"][!UpdateMeter "#CURRENTSECTION#"].J0wNs wrote:Is there a way to preserve my current wallpaper after I refresh the skin?
The newly added !WriteKeyValue bang writes the appropriate value of the Wallpaper variable into the [Variables] section of the skin. This way, when you refresh the skin, it'll reuse the written value of the variable. This means that practically at refresh, the skin sets again the same wallpaper and you won't see any change.
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Icon that sets wallpapers
Thanks a lot!
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania