It is currently September 29th, 2024, 11:21 pm

Changing background based on battery level

General topics related to Rainmeter.
1q2w3e4r5222
Posts: 4
Joined: November 30th, 2012, 6:19 am

Changing background based on battery level

Post by 1q2w3e4r5222 »

Hi, i'm trying to make my first skin.

I've read the tutorials and i know that i need to start with this:

[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent

But after downloading a few battery skins and looking at their .ini files, i do not know how they link the pictures to the skin.

I'm trying to make something like:

MeasureBatteryPercent > 50%, the background changes and etc.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Changing background based on battery level

Post by smurfier »

There are a few methods available. At what percentages do you wish it to change? Did you just want the background of the skin to change or is there something else?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
1q2w3e4r5222
Posts: 4
Joined: November 30th, 2012, 6:19 am

Re: Changing background based on battery level

Post by 1q2w3e4r5222 »

I just wanted my desktop wallpaper to change picture every time the battery reaches 40%
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing background based on battery level

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000

[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent
IfBelowValue=41
IfBelowAction=!SetWallpaper "#@#Images\SadBattery.png" FILL
IfAboveValue=40
IfAboveAction=!SetWallpaper "#@#Images\HappyBattery.png" FILL

[MeterBatteryPercent]
Meter=String
MeasureName=MeasureBatteryPercent
http://docs.rainmeter.net/manual-beta/measures/general-options/ifactions
http://docs.rainmeter.net/manual-beta/bangs#SetWallpaper
http://docs.rainmeter.net/manual-beta/skins/resources-folder
1q2w3e4r5222
Posts: 4
Joined: November 30th, 2012, 6:19 am

Re: Changing background based on battery level

Post by 1q2w3e4r5222 »

Where does the script get the image file from?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5534
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Changing background based on battery level

Post by eclectic-tech »

1q2w3e4r5222 wrote:Where does the script get the image file from?
The example given would place the "SadBattery.png" and "HappyBattery.png" images you want as wallpaper, in an "Image" folder under your "@Resources" folder in your skin: e.g.: {YourDocumentsFolder}\Rainmeter\Skins\{YourBatterySkinName}\@Resources\Images

If the folders don't already exist, create them using your file manager, copy the wallpaper image files into the "Image" folder, then either change the image names to match code names "HappyBattery.png" & "SadBattery.png", or change the names in the code to the names of your wallpaper images.
1q2w3e4r5222
Posts: 4
Joined: November 30th, 2012, 6:19 am

Re: Changing background based on battery level

Post by 1q2w3e4r5222 »

Ah, i see! Thanks for all your help, everyone! Ran the script with no problems at all with the images i wanted!