ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

SOLVED: Log off & Standby in 1-Click

<< < (3/5) > >>

MilesAhead:
The 2 approaches would be, Task Scheduler, or writing a program and using a utility that runs it as a service.

I would ask on this thread:

http://www.autoitscript.com/forum/topic/80201-service-udf-run-your-exe-as-service-updated/page__hl__compiled+script+service__fromsearch__1

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.  The author of the function may help you since the service would just have to do that in addition to the required service functions such as Start, Stop etc..

To write a program I need to be able to test it.  But I never put my machines into sleep or hibernate. Certain system settings I won't change for testing scripts.

If the author's Run As Service function really works then your request should serve(pun intended) as an easy example program.

MilesAhead:
btw 4wd's approach is likely the quick way to accomplish what you want. Having a mechanism to do similar things may be a reason to try the Run As Service approach.

I think I hosed Task Scheduler on my PCs when I was killing off a whole bunch of MS info gathering that I didn't want.  Windows 7 seemed to work for a while with a Calendar program, but after a bit it kept complaining something or other was corrupted(probably means the MS stuff is killed off. If I won't run theirs, they won't run mine.) :)

Ath:
Certain system settings I won't change for testing scripts.
-MilesAhead (October 28, 2011, 03:50 PM)
--- End quote ---
That's what a virtual test-system is good for :)

4wd:
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.-MilesAhead (October 28, 2011, 03:50 PM)
--- End quote ---

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 :D

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.

MilesAhead:
I think the hurdle is just getting a batch or program to run as System.

You can experiment with schtasks.exe to see if you can create a task that's just a .cmd file with commands to log off, then go into standby.  If that approach won't work you can do the logoff trigger.  But using schtasks you should be able to run the task on demand.

See these pages and try it if you like:

http://msdn.microsoft.com/en-us/library/bb736357(v=VS.85).aspx

http://technet.microsoft.com/en-us/library/cc748879.aspx

http://technet.microsoft.com/en-us/library/cc766529.aspx

http://technet.microsoft.com/en-us/library/cc721884.aspx

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version