It is currently April 27th, 2024, 6:50 pm

Help with power plugin.

Get help with creating, editing & fixing problems with skins
the yoshi
Posts: 7
Joined: July 10th, 2012, 7:14 am

Help with power plugin.

Post by the yoshi »

Hi, I'm new to the forums, but I've been creating skins for the past 2 weeks (which I guess would still be considered new).

I'm working on making a "gif" appear and disappear when my laptop is charging and when it isn't. The gif works fine, it just isn't responding to the measure. I can guarantee I left something out, I just cant find any information of what it is.

Code: Select all

[Rainmeter]
Update=50

[PowerStatus]
Measure=PLUGIN
Plugin=PowerPlugin
PowerState=STATUS
Status=1

[SparkleMeter]
Meter=IMAGE
ImageName=ImageMeter

[ImageMeter]
Meter=Image
ImageName=GIF\[ImageNumberCalc].png
DynamicVariables=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 6
Substitute=".00000":""
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Help with power plugin.

Post by Mordasius »

There are a couple of things stopping the skin doing what you want it to do. Firstly, the [PowerStatus] measure will return 0 for no battery, 1 for charging, 2 for critical, 3 for low charge, or 4 for high charge, but the value is not being used anywhere in the skin. Secondly, the [SparkleMeter] meter won't do anything as you need to specify an extension (.jpg, .png, etc.) for the ImageName.

If what you are trying to do is make [ImageMeter] cycle through the images when [PowerStatus] returns 1 and be swiched off when the battery is not charging, then you could try the following:

Code: Select all

[Rainmeter]
Update=1000

[PowerStatus]
Measure=PLUGIN
Plugin=PowerPlugin
PowerState=STATUS
; Status=1 <-- this won't do anything and can be deleted
IfEqualValue=1
IfEqualAction=[!ShowMeter ImageMeter] [!EnableMeasure ImageNumberCalc]
IfAboveValue=1
IfAboveAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]

; [SparkleMeter]  <-- You don't need this meter
; Meter=IMAGE
; ImageName=ImageMeter

[ImageMeter]
Meter=Image
ImageName=GIF\[ImageNumberCalc].png
DynamicVariables=1
Hidden=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 6
Disabled=1 
Another point is that Update=50 would force the skin to update all the measures and meters 1000/50 = 20 times every second! I suggest you use Update=1000 while you are still testing and maybe reduce it to 200-300 to get the 'sparkle' effect you want from the images. You should then put an update divider (see the manual) on [PowerStatus] so it only checks whether or not the battery is charging every few seconds.
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: Help with power plugin.

Post by gmvolk »

Looks like your setting power status to 1 just for testing? For the

Code: Select all

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 6
Substitute=".00000":""
Change it to something like

Code: Select all

[ImageNumberCalc]
Measure=Calc
Formula=ImageNumberCalc % 6
Assuming your "gif" animation has 6 frames, then in

Code: Select all

[ImageMeter]
Meter=Image
ImageName=GIF\[ImageNumberCalc].png
DynamicVariables=1
change it to

Code: Select all

[ImageMeter]
Meter=Image
ImageName=GIF\FILENAME[ImageNumberCalc].png
DynamicVariables=1
Your FILENAME(s) for the "gif" should be something like GIF0.png, GIF1.png

See this page for better explanation http://rainmeter.net/cms/Tips-AnimatedGIF

Thanks
"Pub." Ah, yes: a meeting place where people attempt to achieve advanced states of mental incompetence by the repeated consumption of fermented vegetable drinks.

http://gmvolk.deviantart.com/
the yoshi
Posts: 7
Joined: July 10th, 2012, 7:14 am

Re: Help with power plugin.

Post by the yoshi »

Thanks for the help, but it still isn't really working.
Could you explain to me what the "IfAboveValue and Action" does? I understand the "Equal one, But why do they both equal 1? Also, why are the "Hidden" and "Dissable" on the meter and measure?
Again Thanks for the help because I'm still pretty new to this kind of stuff :confused:
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Help with power plugin.

Post by Mordasius »

the yoshi wrote:I'm still pretty new to this kind of stuff :confused:
In that case I strongly recommend you take some time to read through Rainmeter 101 to get a better grasp on how measures and meters work in Rainmeter.
the yoshi wrote:Could you explain to me what the "IfAboveValue and Action" does? I understand the "Equal one, But why do they both equal 1?
You can read all about IfActions here. What they are saying in this case is that if STATUS=1 (battery charging) then show [ImageMeter] and enable the measure [ImageNumberCalc] which 'calculates' which image number to display. If STATUS>1 (battery not charging) then do the opposite and hide [ImageMeter] and disable [ImageNumberCalc] so that you don't see the flashing images anymore.
the yoshi wrote:Also, why are the "Hidden" and "Dissable" on the meter and measure?
Read about general settings in meters here and general settings in measures here. The Hidden=1 in [ImageMeter] means that [ImageMeter] will not be showing when the skin is first loaded and the Disabled=1 in [ImageNumberCalc] means the calc measure won't be doing anything. This means that you won't see anything until STATUS=1 and the IfEqualAction in [PowerStatus] kicks in to show the meter and start the measure.
the yoshi wrote:Thanks for the help, but it still isn't really working.
Not sure what you mean by this because surely it either is or is not working. Just one little thing that may be causing problems is that on the basis of your first post I assumed you had the images 0.png, 1.png, 2.png, 3.png, 4.png and 5.png in a sub-folder named GIF. e.g. your skin 'Charging.ini' in ...\Rainmeter\Skins\Charging and the images in ...\Rainmeter\Skins\Charging\GIF. This would be the most likely reason why you don't see any images even though the battery is charging.
the yoshi
Posts: 7
Joined: July 10th, 2012, 7:14 am

Re: Help with power plugin.

Post by the yoshi »

Thanks for all the explanations! I've read through the Rainmeter 101 a couple times actually.
I've already made this simple theme (all except the clock part): http://i.imgur.com/CaKKk.jpg?1, and am working on this theme: http://i.imgur.com/yOuTN.jpg. This code is actually to put a shine on the red sword that reads the power to the left.

Unfortunately, It's still not working. Here is the updated code from the suggestions.

Code: Select all

[Rainmeter]
Update=1000

[PowerStatus]
Measure=PLUGIN
Plugin=PowerPlugin
PowerState=STATUS
IfEqualValue=1
IfEqualAction=[!ShowMeter ImageMeter] [!EnableMeasure ImageNumberCalc]
IfABoveValue=1
IfAboveAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]

[ImageMeter]
Meter=Image
ImageName=[ImageNumberCalc].png
DynamicVariables=1
Hidden=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 6
Disable=1
I moved the images to the actual folder with the ".ini" file also.

I'm actually beginning to think that my laptop doesn't support the Status measure...if that can actually happen since it does the Percent fine.

One more thing; is there a difference in the Manual, and the Manual (beta) in the support section of rainmeter?
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Help with power plugin.

Post by Mordasius »

Could you try right-clicking on the rainmeter icon in the SysTray -> About -> Skins -> YourSkin. Look in the panel on the right to see what the value of PowerStatus is. Then click on the 'Log' tab and see what error messages are being reported.

There might be some differences between the Manual, and the Manual (beta) but I wouldn't know about that because I always use the Manual (beta).
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: Help with power plugin.

Post by gmvolk »

When the power gets unplugged, the status goes to 0 and you are not triggering on that. Try something like this

Code: Select all

[Rainmeter]
Update=100

[PowerStatus]
Measure=PLUGIN
Plugin=PowerPlugin
PowerState=STATUS
IfEqualValue=0
IfEqualAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]
IfAboveValue=0
IfAboveAction=[!ShowMeter ImageMeter] [!EnableMeasure ImageNumberCalc]
IfABoveValue=1
IfAboveAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]

[ImageMeter]
Meter=Image
ImageName=[ImageNumberCalc].png
DynamicVariables=1
Hidden=1

[ImageNumberCalc]
Measure=Calc
Formula=Counter % 6
Disable=1
That way if status is 0 or status is above 1 hide your image. Note, I changed the update to 100 just to get a faster animation with the image I was using. Otherwise, interesting idea, I may try this on some stuff.
"Pub." Ah, yes: a meeting place where people attempt to achieve advanced states of mental incompetence by the repeated consumption of fermented vegetable drinks.

http://gmvolk.deviantart.com/
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Help with power plugin.

Post by Mordasius »

gmvolk wrote:When the power gets unplugged, the status goes to 0 and you are not triggering on that. Try something like this

Code: Select all

[PowerStatus]
Measure=PLUGIN
Plugin=PowerPlugin
PowerState=STATUS
IfEqualValue=0
IfEqualAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]
IfAboveValue=0
IfAboveAction=[!ShowMeter ImageMeter] [!EnableMeasure ImageNumberCalc]
IfABoveValue=1
IfAboveAction=[!HideMeter ImageMeter] [!DisableMeasure ImageNumberCalc]
That way if status is 0 or status is above 1 hide your image. Note, I changed the update to 100 just to get a faster animation with the image I was using. Otherwise, interesting idea, I may try this on some stuff.
Sorry but you can't have two IfABoveValue= statements in the same Measure. Also, as STATUS=0 means there is no battery there is no point having a condition to check whether or not it is charging. The only problem with the method I suggested would be if you decided to remove the battery while it was charging and the skin was still running.

If that was a real possibility then you could just add an IfBelowValue=1 and IfBelowAction= to tell you you had just voided your warrenty by removing the battery without switching the computer off first.
:lol:
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: Help with power plugin.

Post by gmvolk »

Thats odd, when I unplug the power the status goes to 0. I did not check to see what would happen with the skin once the battery got charged to where it would return a status of higher than 1.
"Pub." Ah, yes: a meeting place where people attempt to achieve advanced states of mental incompetence by the repeated consumption of fermented vegetable drinks.

http://gmvolk.deviantart.com/