Comments (11)
You've found an interesting case.
Your second option runs in what is known as interactive mode. It can display things to a user in an interactive logon session. That's simple enough, and was the case I originally considered when writing this.
Your first case... to be honest, I'm not sure what exactly it does beyond not requiring an interactive session. This program requires a message queue for the timer that eventually triggers the shutdown - and I wouldn't expect a message queue to exist without a logon session. So it probably creates its own session behind the scenes.
I don't think there's a supported way to hijack a session from a different one. The best that could be done would be a process that's constantly running in the background on every session, and the scheduled non-interactive process communicating with these processes.
Another option is to have one scheduled task for each case - one for the "no users logged in", and one for the "user is logged in". Need some way to detect there's no users logged in. A (rather ugly) way of doing that would be to use other tasks to enable the shutdown task on user log out, and disable it again on user log in. Another way to detect would be to have the logged in one run a little earlier, so the two can communicate (and the second won't run if the first is active).
Incidentally, do you have multiple users on the same machine? Seems like that would require you to create one task per user anyway.
from idleshutdown.
Thank you for the quick response. I tried running the "logged in only" scheduled task follow by the "logged out or in" one shortly afterwards and the "logged out or in" one just shut me down without a warning or option to abort. I was logged in when both tasks started.
I will have to try using the "if computer is idle" option within the task scheduler to get the PC's at login screens, then have different tasks running at different times. I really appreciate your swift reply though.
Thanks
from idleshutdown.
Hm. Let me try something. It shouldn't be too hard to make sure they won't interfere with each other.
I ask again: do you have only a single user? Is there the chance that another user might log in (fast user switching)?
from idleshutdown.
No user switching, each person logs off fully before another logs in.
from idleshutdown.
Well, that guarantee makes things easier. What I'm thinking now is to have an instance launch on user login, and stay running. Any instances launched after that (e.g. by sched task) notify the persistent instance to start the countdown - and if no such persistent instance exists, then there's no user logged in, so shut down immediately.
Of course, this would collapse once you have more than one persistent process - so the single-user guarantee is quite important.
Just need to figure out the IPC.
from idleshutdown.
That sounds like it would work for us perfectly. I wasn't expecting you to put time into resolving the issue just for me. I'm grateful for your assistance.
from idleshutdown.
You can try the persistent branch.
Launch a persistent instance on user login with IdleShutdown /p
(you can do this via Task Scheduler, or the Startup
folder, or the registry Run
key if you want; the latter two should apply to all users more easily). There can only be one persistent instance running at any time - removing this limitation would take considerable effort.
At any time, run IdleShutdown /m <minutes>
. If there's a persistent instance running, that one will be activated. If not, then it'll run by itself.
The notification icon now has an Exit
context menu option. The Abort
button will still exit in non-persistent mode, but in persistent mode it'll only hide - you need to use the Exit
menu option to actually close it.
Note that the /m
option is now necessary to specify a time. See IdleShutdown /?
. This is a side effect of switching to proper options parsing.
Let me know if there are any issues - I've only done minimal testing at this time. Actually, I'd appreciate it if you could let me know if it works, too.
from idleshutdown.
Thanks I will test this out on Monday and let you know the outcome.
from idleshutdown.
Forgive me if I'm being silly, but do you have a download link for the persistent version?
from idleshutdown.
Hm. Looks like GitHub has removed the downloads section and changed it to releases since I last did something on this.
Try here: https://github.com/Elusive138/IdleShutdown/releases/tag/v2.0.0-alpha
Do note this is just for testing - I haven't really added any error handling, so the persistent instance will probably just die completely on a crash if you run into a bug. I'll see if I can improve that later, if I have some time - this little program was never really intended for anything major/serious/complex.
from idleshutdown.
I've now tested this both logged on and off. When logged off the PC shuts down immediately and when logged on the user is prompted to continue or abort the shutdown.
I've created the two scheduled tasks for logon and for night time shutdown and it all works perfectly.
Thank you so much for the time and effort you've put in to this.
from idleshutdown.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idleshutdown.