It is possible. You need a tool for sending the keys
ctrl+windows+c
and a way to schedule this sending. These tools are:
You will need to create a AutoHotkey script to send the key combination,
which is a one-liner file with the .ahk
extension:
send, #^c
You will need to schedule its execution at the days and times that you wish,
using the SCHTASKS command or the Task Scheduler.
You may also disable the hotkey
ctrl+windows+c
by changing in the registry the DWORD item HotkeyEnabled
at the key
HKEY_CURRENT_USER\Software\Microsoft\ColorFiltering
.
Its value is 0
to disable and 1
to enable, and the modification takes
effect immediately.
You may do so programmatically by either using again AutoHotkey with the
RegWrite command,
or by using the batch
REG command.
This seems to work to turn on and off grayscale, but is there a way the script can be activated only if it was activated the night before? For example, if the computer was shutdown at 11pm and the script did not activate, then grayscale mode should not activate in the morning (since instead of turning grayscale off it would turn it on if not activated the night before). – Devin Ersoy – 2019-06-09T21:31:08.720
Also, it seems I am getting the error "Script file not found: C:\Users\Username" when running the script via task scheduler. – Devin Ersoy – 2019-06-09T21:49:43.793
1You can modify the script's behavior by various means, for example using the existence of some file as a switch to tell the script to do its work (or not). An error in the task scheduler means bad task definition. – harrymc – 2019-06-10T06:21:07.740
You can use the registry values to check if grayscale is active or not. For example, the following script always turns grayscaling off but never on (for the converse replace the if check by
if (not isActive)
). ```#NoEnv #Warn SendMode Input SetWorkingDir %A_ScriptDir%RegRead, isActive, HKEY_CURRENT_USER\Software\Microsoft\ColorFiltering, Active
if (isActive) send, #^c