Windows 7 Task Scheduler & Python - Wallpaper doesn't change

情到浓时终转凉″ 提交于 2019-12-11 02:44:12

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/4404771/windows-7-task-scheduler-python-wallpaper-doesnt-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!