Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First off, the background on what I want to do:

I am running rosetta@home on my computers at home and work, and I often find minirosetta tasks stuck in memory when I resume using the computer after a long idle period. I haven't found any real solution to the problem so I am looking for a workaround solution that involves automatically killing the minirosetta tasks when I return from an idle state.

It is possible to kill tasks with a simple command line (in windows7):

taskkill /IM taskname.exe /F

So I am looking for a way to execute a batch script to kill minirosetta tasks when I return from idle mode. Does anyone know if I can use one of the event triggers under windows task scheduler to automatically run a bat file after returning from idle? I see many different possibilities for event triggers but no idea what to use for returning from idle.

Alternatively I could run an executable or bat file when idle, and this executable could wait for mouse/keyboard action before it runs a script to kill the minirosetta tasks. Is this possible with simple scripts or do I need to compile a windows exec?


share|improve this question
up vote 2 down vote accepted

I'm assuming when you return after leaving the PC idle for a while you find the screensaver running and dismiss it using the mouse or keyboard. So one possible solution would be to execute your batch file (or even taskkill directly) on screensaver dismissal.

Event ID 4803 corresponds to The screen saver was dismissed, so all you need to do is turn on logging of this event using the Local Group Policy Editor and then use Task Scheduler to create a task that will be launched when the event occurs. You can find a detailed tutorial for this here.

share|improve this answer
wow, awesome exactly what I was looking for! thank you so much – Peter Hahn Jun 30 '13 at 22:46
well, shucks i only have win7 home premium, so cannot run the local group policy editor. is there any registry hack i can do to enable logging of event 4803? – Peter Hahn Jun 30 '13 at 23:56
The official docs state that "Audit Policy security settings are not registry keys", and the Group Policy Search site didn't return anything. I think you're out of luck unless this works for you, but I've never tried it. – Karan Jul 1 '13 at 0:14
interesting, thanks again! and i was about to try learning and writing python! maybe i still will, working the win api through python seems like it would be convenient – Peter Hahn Jul 1 '13 at 0:27
Did this finally worked? I'm curious because I also want to run a command (to stop an online backup service) once I return to using my computer. – Chuim Jul 13 '13 at 1:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .