2

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!

arboc7
  • 5,762
  • 2
  • 27
  • 30

1 Answers1

5

Make sure that the scheduled task is running with the same privilege as you.

Utku Zihnioglu
  • 4,714
  • 3
  • 38
  • 50