The library is already there to install a compiled AutoIt3 as a service. Basically the service would be running and waiting for notification by a client that it should perform the log off and sleep.
Having already tried to get a service working in AutoIt, (see this thread
), and having no luck with notification after a user logs off - I wouldn't hold your breath
Admittedly I didn't ask in that thread specifically but there was enough information throughout the entire forum for me to try pretty much every way I could - AutoIt is not geared towards running when no user is logged in.
I'll have a look at a Scheduled Task but it won't be this weekend - long weekend - I'm going bush ADDENDUM:
OK, took 5 minutes so I've got it working. @TheArt:
Sorry if I'm quick, I'm expecting pick up soon, someone might be able to fill in any blanks you have over the next 3-4 days.
Prerequisites: Password on the user account, you might also need the power button set to put the system to Sleep rather than Off.
1) Open Task Scheduler and select Create Task (right side of window).
2) Give the task a name, set to run whether user is logged on or not, run with highest privileges - you'll need to enter your account password before leaving this page.
3) Edit the Trigger as follows:
4) Create an Action as follows:
The complete arguments line is: powrprof.dll,SetSuspendState
5) Set the Conditions as follows:
6) OK out of all the windows, you Task should now be listed in the Task Scheduler window.
To test it:
1) Log off
If all goes well, 30 seconds after logging off the computer should go to sleep.
BTW, if you don't want to have it do it all the time then under the Conditions tab you might try setting Computer Idle timeouts and to stop it if it ceases to be idle.