A couple of Sundays ago I was laying in the couch with a small hangover and my kids were watching cartoons I got an idea that I would like to have my theme and desktop wallpaper change with the weather season. Since I am Swedish I wanted the wallpapers to be from my home country. I found out that Microsoft had season themes with desktop pictures from Sweden on their homepage, so I could easily use Bits to download the themes. I made 5 variables with the days of each weather season stored in them and then used a switch to install the correct theme based on season. It worked like a charm and I scheduled a task on my main computer on each login so it will change theme as when season change. I also sync themes on my other computers that use Windows 8.1 and 10 so i get the correct season theme on all my computers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
$Ssu_theme = "SwedishSummer.themepack" $Ssp_theme = "SwedishSpring.themepack" $Win_theme = "SwedishWinter.themepack" $Aut_theme = "SwedishAutumn.themepack" $Ssu = "http://download.microsoft.com/download/A/7/4/A7448DBD-5723-44C1-BBB1-51FB285DEB0E/" + $Ssu_theme $Ssp = "http://download.microsoft.com/download/A/7/4/A7448DBD-5723-44C1-BBB1-51FB285DEB0E/" + $Ssp_theme $Win = "http://download.microsoft.com/download/A/7/4/A7448DBD-5723-44C1-BBB1-51FB285DEB0E/" + $Win_theme $Aut = "http://download.microsoft.com/download/A/7/4/A7448DBD-5723-44C1-BBB1-51FB285DEB0E/" + $Aut_theme $reg_path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\themes" $reg = Get-ItemProperty -Path $reg_path $Ssu_theme_reg = "Swedish S\Swedish S.theme" $Ssp_theme_reg = "Swedish S (2)\Swedish S.theme" $win_theme_reg = "Swedish W\Swedish W.theme" $Aut_theme_reg = "Swedish A\Swedish A.theme" $summer = 152..243 $spring = 60..151 $winter1 = 335..365 $winter2 = 1..59 $winter = $winter1 + $winter2 $Autum = 244..334 $date = get-date switch ($date.DayOfYear) { {$_ -in $summer} { if ($reg.CurrentTheme -notlike "*$Ssu_theme_reg*") { if (Test-Path c:\temp\$Ssu_theme) { & c:\temp\$Ssu_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } else {Start-BitsTransfer $Ssu -Destination c:\temp\$Ssu_theme & c:\temp\$Ssu_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } } } {$_ -in $spring} { if ($reg.CurrentTheme -notlike "*$Ssp_theme_reg*") { if (Test-Path c:\temp\$Ssp_theme) { & c:\temp\$Ssp_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } else {Start-BitsTransfer $Ssp -Destination c:\temp\$Ssp_theme & c:\temp\$Ssp_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } } } {$_ -in $winter} { if ($reg.CurrentTheme -notlike "*$win_theme_reg*") { if (Test-Path c:\temp\$win_theme) { & c:\temp\$win_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } else {Start-BitsTransfer $win -Destination c:\temp\$win_theme & c:\temp\$win_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } } } {$_ -in $Autum} { if ($reg.CurrentTheme -notlike "*$aut_theme_reg*") { if (Test-Path c:\temp\$aut_theme) { & c:\temp\$aut_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } else {Start-BitsTransfer $aut -Destination c:\temp\$aut_theme & c:\temp\$aut_theme Start-Sleep -Seconds 2 $shell = New-Object -ComObject WScript.Shell; $shell.AppActivate('Personalization'); $shell.SendKeys('%{F4}') } }} } |