It is currently December 7th, 2022, 8:04 pm

Shutdown in ...

Skins that control functions in Windows or Rainmeter
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Shutdown in ...

Post by AlC »

Hey guys,

this is just a little skin that I wrote this week. It counts down to 0, like a Countdown :)
It has 4 modes, Shutdown, Standby, Restart or Log Off.

How to Use it ?

- Double left mouse click on "Shutdown/Standby/Restart/Log Off" to change the mode.
- Single left mouse click on "in" to start the countdown time.
- Single right mouse click on "in" to stop the CountDown.

Variables for FontSize,-Face and -Color are in the UserVariables.inc file

If you want to change the font and/or fontsize, you probably have to edit the X's and Y's of the "CountDown Display" meters.

Thanks:
smurfier for his bonus lesson in his "Creating Independent Counters" post in the Rainmeter forum.
Kaelri for his little Lua help.

The wallpaper in the preview image is from here.

;------------------------------
ChangeLog:
v1.1
- now refresh-proofed
- added Font shadow
- changed preview image
Last edited by AlC on August 31st, 2012, 9:24 am, edited 1 time in total.
Rainmeter - You are only limited by your imagination and creativity.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Shutdown in ...

Post by KreAch3R »

I am always amazed when I find out how many ways they are to approach the same thing. Rainmeter freedom is limitless. I do pretty much the same thing, but everything is different (idea, lua, code)!

I really liked what you did with the countdown (appearing only when set), the way you enter your countdown time, plus the fonts are very nice.
When I was building my version, I thought that there might be a problem with sending the command when the time is over, because when the skin is refreshed (say, due to a !RefreshAll bang) the command won't be sent unless the user re-enters the time. Shutdown.exe can accept seconds as a parameter, so I went that way and set the shutdown command upfront.

On the nit-picky ones, I would recommend a background or a StringEffect, because when the skin loaded I couldn't see it because of my dark wallpaper. When I saw the preview, I thought that would be its background, and I really liked it. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: Shutdown in ...

Post by AlC »

First, thanks! :)
KreAch3R wrote:I am always amazed when I find out how many ways they are to approach the same thing.
And I have the same skin without Lua, only Rainmeter and some Calcs, but I had a really little cosmetics error in it.
KreAch3R wrote:... the command won't be sent unless the user re-enters the time.
I'm inquiring, how did you solved that problem? Maybe so ...

WholeTime = #InputHour#*3600+#InputMinutes#*60+#InputSeconds#
shutdown -s -t #WholeTime#
and with !WriteKeyValue I can "save" the time. You are not stupid ;-)
KreAch3R wrote:On the nit-picky ones, I would recommend a background or a StringEffect, because when the skin loaded I couldn't see it because of my dark wallpaper. When I saw the preview, I thought that would be its background, and I really liked it. :)
Yep I will add StringEffect=SHADOW, thanks. I should mention it better in the Description with the fontcolor on dark wallpapers.
I like it when this skin has no background, so it matches on every desktop (especially because of the . . . and the don't displayed time) and with that font it look a little bit "noble".
And yes I'll change the preview, it looks like the complete frame is the skin ...
Rainmeter - You are only limited by your imagination and creativity.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Shutdown in ...

Post by KreAch3R »

AlC wrote: WholeTime = #InputHour#*3600+#InputMinutes#*60+#InputSeconds#
shutdown -s -t #WholeTime#
and with !WriteKeyValue I can "save" the time. You are not stupid ;-)
Yes, I suppose that would work. :) You are not, either. ;)
AlC wrote: Yep I will add StringEffect=SHADOW, thanks. I should mention it better in the Description with the fontcolor on dark wallpapers.
I like it when this skin has no background, so it matches on every desktop (especially because of the . . . and the don't displayed time) and with that font it look a little bit "noble".
And yes I'll change the preview, it looks like the complete frame is the skin ...
I am also in favor of skins that match any background. After tests, I found that using these settings doesn't affect the result I wanted in the first place, but makes the difference if the colors (wallpaper and fontcolor) are very similar:
; When FontColor = Black-ish
StringEffect=SHADOW
FontEffectColor=FFFFFF55

; When FontColor = White-ish
StringEffect=SHADOW
FontEffectColor=00000055
Try them to see what I mean. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: Shutdown in ...

Post by AlC »

Updated to v1.1

It's now refresh-proofed. :)

For KreAch3R: How I realized it (short version):

I done it completely different now. First I saved the last values of Hour, Minute and Second with Lua. Thanks Kaelri!
if (cHour ~= LastHour) then
LastHour = cHour
SKIN:Bang('!WriteKeyValue Variables RefreshHour '..LastHour..'')
end

if (cMinutes ~= LastMinute) then
LastMinute = cMinutes
SKIN:Bang('!WriteKeyValue Variables RefreshMinute '..LastMinute..'')
end

if (cSeconds ~= LastSecond) then
LastSecond = cSeconds
SKIN:Bang('!WriteKeyValue Variables RefreshSecond '..LastSecond..'')
end
Now after a refresh I check if RefreshHour/Minute/Second is not 0. Then I set MaxHours/Minutes/Seconds in Lua and start the script.
[mCheckRefresh]
Measure=Calc
Formula=(#RefreshHour#<>0)||(#RefreshMinute#<>0)||(#RefreshSecond#<>0)
IfAboveValue=0
IfAboveAction=[!CommandMeasure mScript "GetRefreshNumbers()"][!CommandMeasure "mInput" "ExecuteBatch 8-12"]
UpdateDivider=-1
DynamicVariables=1

...

function GetRefreshNumbers()
local RefreshHour = SKIN:GetVariable('RefreshHour')
local RefreshMinute = SKIN:GetVariable('RefreshMinute')
local RefreshSecond = SKIN:GetVariable('RefreshSecond')

MaxHours = RefreshHour
MaxMinutes = RefreshMinute
MaxSeconds = RefreshSecond
end
And of course it's important to set everything to 0 after it's done or you stopped the countdown.
OnCloseAction=[!WriteKeyValue Variables RefreshHour 0][!WriteKeyValue Variables RefreshMinute 0][!WriteKeyValue Variables RefreshSecond 0]

...

[in]
Meter=String
MeterStyle=sShutdown
X=10R
Text="in"
LeftMouseUpAction=[!CommandMeasure "mInput" "ExecuteBatch 1-12"]
RightMouseUpAction=[!WriteKeyValue Variables RefreshHour 0][!WriteKeyValue Variables RefreshMinute 0][!WriteKeyValue Variables RefreshSecond 0][!Refresh]

...

if cHour==0 and cMinutes==0 and cSeconds==0 then
SKIN:Bang('!WriteKeyValue Variables RefreshHour 0')
SKIN:Bang('!WriteKeyValue Variables RefreshMinute 0')
SKIN:Bang('!WriteKeyValue Variables RefreshSecond 0')
SKIN:Bang('#Bang1#')
SKIN:Bang('!Refresh')
end
KreAch3R wrote:I am always amazed when I find out how many ways they are to approach the same thing
Me too :)

;------------------------------
And thanks for the shadow tipp!

;------------------------------
Changed the preview image.

PS: Someone on Deviantart has probably a problem with the skin. He wrote
"spawn Invalid settings file in:"
if someone else has this problem or can explain for what this error stand for, please say it.
Rainmeter - You are only limited by your imagination and creativity.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Shutdown in ...

Post by KreAch3R »

Very nice. :) I like the new preview, too. It looks better than the previous, and definitely lets you now that the skin is transparent.
AlC wrote: PS: Someone on Deviantart has probably a problem with the skin. He wrote
"spawn Invalid settings file in:"
if someone else has this problem or can explain for what this error stand for, please say it.
I think Merlin also had this problem with one user that reported "Invalid settings file" during the .rmskin installation of one of his skins. I couldn't reproduce it in either cases, though.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image