I am attempting to run a Python script every five minutes to update a Windows 7 desktop background. It runs perfectly when started from the command-line, but not as a scheduled task.
The relevant code:
import ctypes
# According to MSDN/other websites
SPI_SETDESKWALLPAPER = 20
# Update wallpaper
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, pathToWallpaper, 0)
The scheduled task runs, and my temporary .bmp (at pathToWallpaper) is created, but the desktop doesn't update. I've tried changing the task permissions to no avail.
What am I missing? Thanks in advance for your help!