Here is a script anyone can use to automate control of James' workaround. James' workaround on its own prevents a PC from sleeping or hibernating. This script will allow sleep/hibernate to function normally whilst eliminating the "silent stream bug".
This is how you use it:
- Install James' fix to %SystemDrive%\Program Files\Slysoft\ATI_Fix\ (or, if you are adventurous, alter this location in the script)
- Set
any screensaver to start at least 1 minute before your desired sleep/hibernate time. If you don't really like/want a screensaver, this could be as simple as a single full screen photo saying something like "getting ready to sleep", in a folder by itself pointed to using the built in "photos" screensaver, set to trigger just 1 minute before the PC sleeps.
- Set this script to run on system boot, e.g. put a shortcut to it in your Startup folder
- you are done!
...................
I have improved on my old script. See attached.
This one:
- Does less work after the first loop, when the PC is active (no screensaver). It simply checks to see if a screensaver has become active. Previously, on every loop, if the screensaver was not active it would check if the ATI Fix was running and, if not, start it. Now it assumes it did its job the first time!
- Has a different polling interval when a screensaver is active to when one is not. When a screensaver is active it polls every 2 seconds to see if it has stopped. This ensures the ATI Fix is activated no more than 2 seconds after exiting the screensaver. When a screensaver is inactive, and the PC is in active use, the polling interval drops to 1 minute to minimise resource utilisation.
Jon
Code:
Set objShell = CreateObject("WScript.Shell")
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Do
' Start ATI Silent Stream Fix if not already running
ATI_fix_Processcount = 0
Set ATI_Fix_colProcesses = service.ExecQuery _
("Select * from Win32_Process Where name = 'ATI-anti-pop.exe'")
For Each objProcess in ATI_Fix_colProcesses
ATI_fix_Processcount = ATI_fix_Processcount + 1
Next
IF ATI_fix_Processcount = 0 then objShell.Run "%SystemDrive%\Progra~1\Slysoft\ATI_Fix\ATI-anti-pop.exe", 0
' Check to see if a screensaver has become active
scr_Processcount = 0
Do
WScript.Sleep 60000
Set scr_colProcesses = service.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in scr_colProcesses
IF Right(objProcess.Name, 4) = ".scr" then scr_Processcount = scr_Processcount +1
Next
Loop While scr_Processcount = 0
' When a screensaver has become active terminate all instances of the ATI fix
Set ATI_Fix_colProcesses = service.ExecQuery _
("Select * from Win32_Process Where name = 'ATI-anti-pop.exe'")
For Each objProcess in ATI_Fix_colProcesses
objProcess.Terminate()
next
' Check to see if no screensavers are running
Do
scr_Processcount = 0
WScript.Sleep 2000
Set scr_colProcesses = service.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in scr_colProcesses
IF Right(objProcess.Name, 4) = ".scr" then scr_Processcount = scr_Processcount +1
Next
Loop Until scr_Processcount = 0
' When no screensavers are running loop to the top to restart the ATI Fix
Loop