It is currently November 30th, 2022, 4:11 am

Simple countdown timer

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 2nd, 2021, 12:19 pmIt's a shame XYplorer forum isn't this good! It's a nightmare in comparison! :o I wish I could get the help with the scripting like on here!
I use Total Commander (similar stuff, literally the 1st thing I install after the drivers). Regarding your goal, you can always make a shutdown task in Windows Task Scheduler (say, 120 minutes from logon time or along those lines), or even in PowerShell if possible, and simply use Rainmeter (that starts with Windows as well, i.e. at more or less the logon time) just to display the remaining time your son has left to use the PC. You don't have to do everything through Rainmeter - just saying...

P.S. One can use Rainmeter to create those Task Scheduler tasks (or even re-create them if a check reveals they don't exist yet, in order to "enforce" those parental restrictions) by using some relatively simple PowerShell script like here that can be executed by a RunCommand measure from within your Rainmeter skin at logon.
Last edited by Yincognito on July 2nd, 2021, 1:28 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 14744
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

sl23 wrote: July 1st, 2021, 8:34 pm Can I please get some help creating a simple countdown timer. I've looked at balala's and at JSMorley's code earlier in this thread, but can't seem to get what I want. Balala's skin is great, but I really want it as simple as possible.
I saw all replies posted in meantime, but here is a short description on what should you do. Just note that Rainmeter is definitely not the tool you should use to efficiently restrict your son on using the computer. Much versatile tools are out there. But just "for fun", here is the simplest way to achieve what you want. Note that probably many guys will post the disadvantages of this method and I don't contest them, but this is definitely the simplest way. In fact you need one single Calc measure, for instance the following one:

Code: Select all

[MeasureCount]
Measure=Calc
Formula=( MeasureCount + 1 )
IfCondition=(#CURRENTSECTION#>=60*#Delay#)
IfTrueAction=Bangs-for-action-to-execute-when-the-time-goes-by
Disabled=1
If you set in the [Variables] section the Delay variable (which is the time in minutes after which the action has to be executed, for instance Delay=60 for one hour), you need to add one single bang to the rest of your code, which will enable the above [MeasureCount] measure when you want to start the timer. For example modify the LeftMouseUpAction option of the [Rainmeter] section to LeftMouseUpAction=[!EnableMeasure "MeasureCount"].
And again: I don't contest the above method has its own disadvantages, it definitely has. However since you've asked for a simple way, this is in my opinion the simplest ever possible method. If interested and you want, please let me know for further assistance on how to exactly implement this in your skin.
User avatar
sl23
Posts: 1038
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Thanks for the extra info, I'm happy the skin is simple enough and works, so I'll leave it at that
Thank you for your help.
User avatar
balala
Rainmeter Sage
Posts: 14744
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

sl23 wrote: July 2nd, 2021, 8:23 pm I'm happy the skin is simple enough and works, so I'll leave it at that
Ok, as you wish.
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 2nd, 2021, 8:23 pm Thanks for the extra info, I'm happy the skin is simple enough and works, so I'll leave it at that
Thank you for your help.
No problem. I guess you're a good father, after all, you do leave your son a way out. :D
Just curious though, apart from the nice skin and code: what's stopping him to power on the computer again after the skin shut it down the way you designed it to? On the other hand, a father - son talk about this and some Event Viewer checking by you afterwards would not only reveal if he himself shut down the PC when you advised him to, but also if he's trying to lie to you about it (shooting 2 rabbits with it, teaching him both responsibility and honesty). Anyway, not my place to talk about these things since it's your choice, prerogatives and all that, I just wondered about the effectiveness of the process, that's all. :confused:
User avatar
balala
Rainmeter Sage
Posts: 14744
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

Yincognito wrote: July 2nd, 2021, 8:58 pm Just curious though, apart from the nice skin and code: what's stopping him to power on the computer again after the skin shut it down the way you designed it to?
Definitely (as I said above) Rainmeter is not the tool for this. A much versatile software tool should be used to enforce such a restriction. This restriction is out of what Rainmeter can do or what it has been designed for.
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

balala wrote: July 3rd, 2021, 12:43 pm Definitely (as I said above) Rainmeter is not the tool for this. A much versatile software tool should be used to enforce such a restriction. This restriction is out of what Rainmeter can do or what it has been designed for.
Well, I guess this is probably meant to be more of a nice looking "guideline" than a strict restriction process. On the other hand, even the most versatile tool's actions can be reverted if one has the right tools or knowledge, but I suppose this is not a problem when it comes to a 9 years old. :)
User avatar
sl23
Posts: 1038
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Yincognito wrote: July 3rd, 2021, 1:11 pm Well, I guess this is probably meant to be more of a nice looking "guideline" than a strict restriction process. On the other hand, even the most versatile tool's actions can be reverted if one has the right tools or knowledge, but I suppose this is not a problem when it comes to a 9 years old. :)
Indeed, it is just something that is to help with the parenting, not replace it. :D
User avatar
Yincognito
Rainmeter Sage
Posts: 4817
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 4th, 2021, 3:27 pm Indeed, it is just something that is to help with the parenting, not replace it. :D
Yep, difficult job, but usually rewarding in the long run. :thumbup:
User avatar
sl23
Posts: 1038
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Definitely :thumbup: but tiring :yawn: :D