It is currently April 19th, 2024, 9:52 am

Change Wallpaper on Rainmeter Start

Get help with creating, editing & fixing problems with skins
User avatar
WandersFar
Posts: 46
Joined: January 25th, 2010, 3:38 pm

Change Wallpaper on Rainmeter Start

Post by WandersFar »

Can someone look this over and see if I've done this correctly? I just tested it and it works, but I don't really know what I'm doing and I'd like to know if there's a better approach. Thanks.

Code: Select all

[Rainmeter]
Update=1000

[MeasureWallpaper]
Measure=Plugin
Plugin=QuotePlugin
PathName=[path to wallpaper folder]
FileFilter=*.bmp;*.gif;*.jpg;*.png;*.tiff
UpdateDivider=-1

[WallCounter]
Measure=Calc
Formula=WallCounter+1
IfEqualValue=1
IfEqualAction=!Execute [!UpdateMeasure MeasureWallpaper][!SetWallpaper "[MeasureWallpaper]"]
UpdateDivider=-1

[DummyMeter]
Meter=String
The goal is to have Rainmeter load a random wallpaper every time it starts up or is refreshed.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Change Wallpaper on Rainmeter Start

Post by Kaelri »

The approach is good. :) Just a few minor things I would change:

- When UpdateDivider=-1, the measure does update once when the skin is loaded, so you don't need to [!UpdateMeasure MeasureWallpaper].
- You do need to set DynamicVariables=1 on the Calc measure in order to set the wallpaper to a measure value.

Code: Select all

[Rainmeter]

[MeasureWallpaper]
Measure=Plugin
Plugin=QuotePlugin
PathName=[path to wallpaper folder]
FileFilter=*.bmp;*.gif;*.jpg;*.png;*.tiff
UpdateDivider=-1

[WallCounter]
Measure=Calc
Formula=1
IfEqualValue=1
IfEqualAction=!SetWallpaper "[MeasureWallpaper]"
UpdateDivider=-1
DynamicVariables=1

[DummyMeter]
Meter=String
Also, you may already know this, but for anyone who doesn't: normally, you can use OnRefreshAction to trigger an action when the skin is loaded. The reason you can't do that here is because the action includes a dynamic variable, which can only be used in a meter or measure, not the [Rainmeter] section.

EDIT: I was actually wrong about that. Using the measure value in OnRefreshAction appears to work, even though I'm not sure it's supposed to. That means the following would work, as well:

Code: Select all

[Rainmeter]
OnRefreshAction=!SetWallpaper "[MeasureWallpaper]"

[MeasureWallpaper]
Measure=Plugin
Plugin=QuotePlugin
PathName=[path to wallpaper folder]
FileFilter=*.bmp;*.gif;*.jpg;*.png;*.tiff
UpdateDivider=-1

[DummyMeter]
Meter=String
User avatar
WandersFar
Posts: 46
Joined: January 25th, 2010, 3:38 pm

Re: Change Wallpaper on Rainmeter Start

Post by WandersFar »

I did not know about OnRefreshAction, thank you! That slims down the ini quite nicely.
Grmblfz
Posts: 12
Joined: December 25th, 2018, 8:25 pm

Re: Change Wallpaper on Rainmeter Start

Post by Grmblfz »

Hey,
I want to make a Live Wallpaper skin for Rainmeter.
This technique should work, right? If I Update the Wallpaper every 1/30s with the next frame it should work.
I'll try and keep you up to date.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Change Wallpaper on Rainmeter Start

Post by balala »

Grmblfz wrote: December 26th, 2018, 11:46 am If I Update the Wallpaper every 1/30s with the next frame it should work.
:o You mean you'll update it 30 times per second? Will cause you a lot of headache. :o
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Change Wallpaper on Rainmeter Start

Post by jsmorley »

I don't recommend even exploring this. Rainmeter will just eat up CPU trying to update the entire screen at a rate that even approaches "live".
Grmblfz
Posts: 12
Joined: December 25th, 2018, 8:25 pm

Re: Change Wallpaper on Rainmeter Start

Post by Grmblfz »

Yup, I thought about that too but I finally got it to work:

Code: Select all

[Rainmeter]
Update=100

[Variables]
MaxPictures=294
Path=#@#Wallpaper\Darth_Vader_
Ending=.jpg

[cCounter]
Measure=Calc
Formula=cCounter%#MaxPictures#+1

[Wallpaper]
Meter=Image
OnUpdateAction=[!SetWallpaper #Path#[cCounter]#Ending#]
DynamicVariables=1
It's laggy as hell but, hey! I'll try it with an Image that is behind everything, just a sec!
Last edited by balala on December 28th, 2018, 12:39 pm, edited 1 time in total.
Reason: Please use [code] tags when posting code snippets, not [Snippet]. It's the </> button.
Grmblfz
Posts: 12
Joined: December 25th, 2018, 8:25 pm

Re: Change Wallpaper on Rainmeter Start

Post by Grmblfz »

Ok this is much better somehow...

Code: Select all

[Rainmeter]
Update=120

[Variables]
MaxPictures=294
Path=#@#Wallpaper\Darth_Vader_
Ending=.jpg
ScreenW=1600
ScreenH=900

[cCounter]
Measure=Calc
Formula=cCounter%#MaxPictures#+1

[Wallpaper]
Meter=Image
ImageName="#Path#[cCounter]#Ending#"
W=#ScreenW#
H=#ScreenH#
X=0
Y=0
DynamicVariables=1
So you can't see any Windows Symbols on your Desktop any more but the CPU is a bit higher than normal (not extreme) and the image is updating fluently. :D
Any Tips on how to get this to work better?
I'll see if I can get the Image behind even the Windows Symbols.
Last edited by balala on December 28th, 2018, 12:40 pm, edited 1 time in total.
Reason: Please use [code] tags when posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Change Wallpaper on Rainmeter Start

Post by balala »

Grmblfz wrote: December 28th, 2018, 10:43 am Yup, I thought about that too but I finally got it to work:

Code: Select all

[Rainmeter]
Update=100

[Variables]
MaxPictures=294
Path=#@#Wallpaper\Darth_Vader_
Ending=.jpg

[cCounter]
Measure=Calc
Formula=cCounter%#MaxPictures#+1

[Wallpaper]
Meter=Image
OnUpdateAction=[!SetWallpaper #Path#[cCounter]#Ending#]
DynamicVariables=1
It's laggy as hell but, hey! I'll try it with an Image that is behind everything, just a sec!
As both jsmorley and I said, I don't think setting a wallpaper so often is a good idea. Probably sooner or later you'll get freezing your computer. 10 times per second is a bit too much...
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Change Wallpaper on Rainmeter Start

Post by balala »

Grmblfz wrote: December 28th, 2018, 10:56 am Ok this is much better somehow...

Code: Select all

[Rainmeter]
Update=120

[Variables]
MaxPictures=294
Path=#@#Wallpaper\Darth_Vader_
Ending=.jpg
ScreenW=1600
ScreenH=900

[cCounter]
Measure=Calc
Formula=cCounter%#MaxPictures#+1

[Wallpaper]
Meter=Image
ImageName="#Path#[cCounter]#Ending#"
W=#ScreenW#
H=#ScreenH#
X=0
Y=0
DynamicVariables=1
So you can't see any Windows Symbols on your Desktop any more but the CPU is a bit higher than normal (not extreme) and the image is updating fluently. :D
Any Tips on how to get this to work better?
I'll see if I can get the Image behind even the Windows Symbols.
This code doesn't set wallpaper. Probably that's why it runs much more fluently. However you have there an Image meter which still updates almost 10 times per second. Still too much, even if it doesn't set the wallpaper. You can't even take a much or less normal look to those images. Still have no idea what would you like to achieve.