blog:change_windows_desktop_background_for_day_and_night_using_batchfile
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:change_windows_desktop_background_for_day_and_night_using_batchfile [2010-12-23 08:00] – brb | blog:change_windows_desktop_background_for_day_and_night_using_batchfile [2010-12-26 07:26] (current) – brb | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Change windows desktop background for day and night, using batchfile ====== | ====== Change windows desktop background for day and night, using batchfile ====== | ||
- | <code winbatch> | + | Having a bright, blue wallpaper for day use and a darker, reddish wallpaper for evening/ |
- | ::==chwallpaper.bat | + | |
- | Echo %Time% | + | {{: |
- | for /f " | ||
- | " | ||
- | set wallpaper=e: | + | Advantages: |
- | if %hours% LSS 8 goto setnight | + | * No additional software (apart from the script) has to be installed |
- | if %hours% GTR 20 goto setnight | + | * No additional load on the computer by a desktop switcher, except from the tasks that you define yourself |
+ | |||
+ | Notes: | ||
+ | * You must convert your jpg wallpaper to bmp (changing the dimensions to exactly match your screen). You can't directly use a jpg file as a windows wallpaper (the settings dialog creates a bmp file behind your back!). | ||
+ | * Configuration is by changing the set ... variable at the top of the file | ||
+ | * Test by calling the batchfile | ||
+ | * To automate the wallpaper | ||
+ | * make a link in the windows autostart folder | ||
+ | * add an hourly task to the task manager (or even cleaner, two tasks at the switch times (7:00 and 20:00) | ||
+ | |||
+ | <code winbatch> | ||
+ | REM :: chwpdn. batchange to CHange the WallPaper for Day and Night | ||
+ | REM :: v1.0 B.Brunner, 23.12.2010 (brb_trash at epr dot ch) | ||
+ | REM Prepare two bmp files to be used during day and night | ||
+ | REM - jpgs dont work directly, convert to bmp of your screen resolution first! | ||
+ | REM - change start and end day hour to your needs | ||
+ | REM - store this batchfile in a place like e:\etc | ||
+ | REM - make a link to this batchfile in your autostart folder (set minimized in the link) | ||
+ | REM - using the task manager have the batchfile start every hour, to switch during the day | ||
+ | REM | ||
+ | REM Configuration changes go here | ||
+ | set wpnight=e:\etc\wallpaper_night.bmp | ||
+ | set wpday=e: | ||
+ | set daystarthour=7 | ||
+ | set dayendhour=20 | ||
+ | |||
+ | REM Set hours variable | ||
+ | for /f " | ||
+ | |||
+ | REM Use day wallpaper, except from 00:00-08:00 and 20: | ||
+ | set wallpaper=%wpday% | ||
+ | if %hours% LSS %daystarthour% | ||
+ | if %hours% GTR %dayendhour% | ||
goto setit | goto setit | ||
:setnight | :setnight | ||
- | set wallpaper=e: | + | set wallpaper=%wpnight% |
:setit | :setit | ||
- | |||
Echo Setting wallpaper to %wallpaper% | Echo Setting wallpaper to %wallpaper% | ||
REG ADD " | REG ADD " | ||
RUNDLL32.EXE user32.dll, | RUNDLL32.EXE user32.dll, | ||
- | |||
- | :finish | ||
</ | </ | ||
blog/change_windows_desktop_background_for_day_and_night_using_batchfile.1293087620.txt.gz · Last modified: 2010-12-23 08:00 by brb