VBS script to detect idle time like a screensaver
<p>I want to know how to make an idle time counter in vbs, like a screensaver so when the idle time exeeds lets say 10 mins, it launches my screensaver and resets it to 0. When the mouse is moved, I also want it to end the screensaver, which I think is possible when it ends the procces in task manager named cmd.exe (the screensaver runs in cmd) here is what I have done so far, and thank you in advance</p>

<pre><code>Const strComputer = "." 
Dim objWMIService, colProcessList
Set objWMIService = GetObject("winmgmts:" &amp; "{impersonationLevel=impersonate}!\\" &amp; strComputer &amp; "\root\cimv2")

Dim StartTime, EndTime, Elapsed

StartTime = Timer

Elapsed = Timer - StartTime

for each Process in Service.InstancesOf ("Win32_Process")

If Timer &gt; 1000 Then
If Process.Name = "cmd.exe" then
sleep 0
else
createObject("WScript.Shell").Run "screensaver.bat"
if (mouse move)                                                *NOT DONE*
   Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'cmd.exe'")
  For Each objProcess in colProcessList 
    objProcess.Terminate() 

StartTime = 0
EndTime = 0
Elapsed = 0
Timer = 0
end if
next


   Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'Process.exe'")
  For Each objProcess in colProcessList 
    objProcess.Terminate() 

  Next  
</code></pre>