It is currently March 29th, 2024, 12:24 pm

Automatic extinction

Get help with creating, editing & fixing problems with skins
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Automatic extinction

Post by PtitChat107 »

Hello everyone,
I wanted to know if it would be possible to create an automatic shutdown system based solely on the computer's time; for example if by chance I fall asleep having forgotten to turn off my computer; pass a certain time (in this format: HH:MM:SS) the condition changes and starts the shutdown command: shutdown.exe -s -t 60

Code: Select all

[Variables]
@include=\UserVariables.inc
; ----------------------------------
; MEASURES
; ----------------------------------

[measureTime]
Measure=Time
Format=%H:%M:%S

[Automatic extinction]
Measure=Calc
IfCondition= Time = 03:00:00
IfTrueAction=#Shutdown#
I'm really not sure if my example is right but it gives me an idea of what I have in mind, if it can be helpful to someone.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatic extinction

Post by balala »

PtitChat107 wrote:I wanted to know if it would be possible to create an automatic shutdown system based solely on the computer's time; for example if by chance I fall asleep having forgotten to turn off my computer; pass a certain time (in this format: HH:MM:SS) the condition changes and starts the shutdown command: shutdown.exe -s -t 60
This way won't work, because the IfCondition must have to be entirely numeric. But you could use an IfMatch option. The [Automatic extinction] measure isn't even needed. Remove it and add the following options to the [measureTime] measure (leave untouched the not posted options of the measure):

Code: Select all

[measureTime]
...
IfMatch=03:00:00
IfMatchAction=#Shutdown#
I suppose the Shutdown variable is defined in the [Variables] section. Is it?
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Automatic extinction

Post by PtitChat107 »

balala wrote:

Code: Select all

[measureTime]
...
IfMatch=03:00:00
IfMatchAction=#Shutdown#
Oh yes, I did not think about it; thank you Balala!
balala wrote:I suppose the Shutdown variable is defined in the [Variables] section. Is it?
Yes that's right, I already have a file containing a lot of variables so I group everything in order to gain efficiency !
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatic extinction

Post by balala »

PtitChat107 wrote:Yes that's right, I already have a file containing a lot of variables so I group everything in order to gain efficiency !
Ok, let me know if it works well.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Automatic extinction

Post by jsmorley »

To be honest, I would quickly become annoyed with a skin that yanked the system out from under me, no matter what the time. While using that shutdown command will give you 60 seconds to quickly save what you are working on, there is no way to say "Wait, I'm actually working on something, never mind!"

I would use something like this:

Code: Select all

[Rainmeter]
Update=500
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!Move (#SCREENAREAWIDTH#/2-(#SkinW#/2)) (#SCREENAREAHEIGHT#/2-(#SkinH#/2))][!ZPos 2]

[Variables]
SkinW=174
SkinH=130
DelaySeconds=60
Shutdown=[shutdown.exe -s -hybrid -f -t 00]

[MeasureTime]
Measure=Time
Format=%H:%M:%S
IfMatch=03:00:00
IfMatchAction=[!ShowMeterGroup Counter][!EnableMeasure MeasureCounter]

[MeasureCounter]
Measure=Loop
StartValue=#DelaySeconds#
EndValue=1
Increment=-1
Disabled=1
UpdateDivider=2
IfCondition=MeasureCounter = 1
IfTrueAction=#Shutdown#

[MeterBackground]
Meter=Shape
Group=Counter
Hidden=1
Shape=Rectangle 0.5,0.5,169,124,12 | Fill Color 20,20,20,255 | StrokeWidth 1.5 | Stroke Color 150,150,150,255
W=170
H=125

[MeterInformation]
Meter=String
Group=Counter
Hidden=1
W=169
X=(169/2)
Y=7
StringAlign=Center
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
InlineSetting=Weight | 700
InlinePattern=#CRLF#(.*)#CRLF#
Text=Shutdown in#CRLF#[MeasureCounter]#CRLF#Seconds

[MeterButton]
Meter=Shape
Group=Counter
Hidden=1
X=45
Y=80
Shape=Rectangle 0.5,0.5,80,30,10 | Fill Color 87,87,87,255
LeftMouseUpAction=[!Refresh]

[MeterCancel]
Meter=String
Group=Counter
Hidden=1
X=51
Y=80
FontSize=13
FontWeight=700
FontColor=255,255,255,255
SolidColor=0,0,0,1
Padding=5,5,5,5
AntiAlias=1
Text=Cancel
1.jpg
This is entirely invisible until it is 03:00:00. Then it will appear in the center of your screen.

It will still wait #DelaySeconds# (60 seconds) amount of time, and if you are not there, it will still shutdown, but if you are there, you can just click on Cancel within that 60 seconds and it is reset until the next day and disappears.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatic extinction

Post by balala »

jsmorley wrote:I would use something like this:
Probably you're right and I understand this isn't something very important, but I wouldn't refresh the skin when the Cancel button is clicked. Instead I'd replace the LeftMouseUpAction option of the [MeterButton] with something which would disable the [MeasureCounter] and would hide the meters belonging to the Counter group:

Code: Select all

[MeterButton]
...
LeftMouseUpAction=[!HideMeterGroup "Counter"][!DisableMeasure "MeasureCounter"]
That because in the last period we've reccommended more times to avoid as much as it is possible to refresh the skins.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Automatic extinction

Post by jsmorley »

balala wrote:Probably you're right and I understand this isn't something very important, but I wouldn't refresh the skin when the Cancel button is clicked. Instead I'd replace the LeftMouseUpAction option of the [MeterButton] with something which would disable the [MeasureCounter] and would hide the meters belonging to the Counter group:

Code: Select all

[MeterButton]
...
LeftMouseUpAction=[!HideMeterGroup "Counter"][!DisableMeasure "MeasureCounter"]
That because in the last period we've reccommended more times to avoid as much as it is possible to refresh the skins.
No, I believe this is an example of where [!Refresh] is the most direct and most efficient way to accomplish the task. I see no reason to complicate it, if you refresh, it won't be 03:00:00 anymore...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatic extinction

Post by balala »

jsmorley wrote:No, I believe this is an example of where [!Refresh] is the most direct and most efficient way to accomplish the task.
Why?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Automatic extinction

Post by jsmorley »

balala wrote:Why?
I see no reason to complicate it, if you refresh, it won't be 03:00:00 anymore, and the skin will be reset until the next day. Manually turning off and hiding everything is just a few steps that don't buy you anything. But either way, there is no huge advantage to using !Refresh in this case either.

In any case this is a bit "brute force", and if someone wanted to be really clever, they could have buttons for "wait another hour", "wait another 2 hours", "don't do this tonight" or whatever. The only thing I probably couldn't live with is a skin that just cuts my legs out from under me while I'm in the middle of working on something. That would only ever happen once...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Automatic extinction

Post by balala »

jsmorley wrote:I see no reason to complicate it, if you refresh, it won't be 03:00:00 anymore, and the skin will be reset until the next day. Manually turning off and hiding everything is just a few steps that don't buy you anything.
Yes, indeed, you're right.