Skip to content

Commit dae0e51

Browse files
v1.0.46
- Fixed a parsing error in the Setup script
1 parent 07adb4c commit dae0e51

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
# AUTO THEME
33
Powershell script which changes the active Windows theme and Desktop background based on daylight or a predefined schedule. Works in Windows 10/11.
44

@@ -73,7 +73,12 @@ Workarounds have been added for a number of apps which do not toggle theme grace
7373

7474
<p>&nbsp;</p>
7575

76-
## Changelog
76+
77+
78+
### v1.0.46 (2026-01-16)
79+
- Fixed a parsing error in the Setup script
80+
81+
7782

7883
### v1.0.45 (2026-01-13)
7984
MAJOR UPDATE:

at-setup.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ if ($addContextMenu) {
196196
$parentKey = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\AutoTheme"
197197
$subKey = "$parentKey\shell"
198198

199+
# Commands
200+
# Next Wallpaper (no console window)
201+
$psNext = 'conhost.exe --headless PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command "& {0} -Next"' -f "'$AutoThemeScript'"
202+
# Toggle Theme
203+
$psToggle = 'PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command "& {0} -Toggle"' -f "'$AutoThemeScript'"
204+
# Refresh Schedule
205+
$psSched = 'PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command "& {0} -Schedule"' -f "'$AutoThemeScript'"
206+
199207
try {
200208
# 1. Parent Entry (No changes here)
201209
New-Item -Path "Registry::$parentKey" -Force | Out-Null
@@ -210,15 +218,15 @@ if ($addContextMenu) {
210218
New-Item -Path "Registry::$nextPath\command" -Force | Out-Null
211219
Set-ItemProperty -Path "Registry::$nextPath" -Name "(Default)" -Value "Next background picture"
212220
Set-ItemProperty -Path "Registry::$nextPath" -Name "Icon" -Value "imageres.dll,-21"
213-
$psNext = "conhost.exe --headless PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Next`\""
221+
# $psNext = "conhost.exe --headless PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Next`\""
214222
Set-ItemProperty -Path "Registry::$nextPath\command" -Name "(Default)" -Value $psNext
215223

216224
# 3. Toggle Theme (Middle)
217225
$togglePath = "$subKey\Toggle"
218226
New-Item -Path "Registry::$togglePath\command" -Force | Out-Null
219227
Set-ItemProperty -Path "Registry::$togglePath" -Name "(Default)" -Value "Toggle Theme Now"
220228
Set-ItemProperty -Path "Registry::$togglePath" -Name "Icon" -Value "themecpl.dll,-1"
221-
$psToggle = "PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Toggle`\""
229+
# $psToggle = "PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Toggle`\""
222230
Set-ItemProperty -Path "Registry::$togglePath\command" -Name "(Default)" -Value $psToggle
223231

224232
# 4. Refresh Schedule (Pinned to Bottom)
@@ -229,8 +237,8 @@ if ($addContextMenu) {
229237
Set-ItemProperty -Path "Registry::$parentKey" -Name "SeparatorBefore" -Value ""
230238
# This is the trick to move it to the end:
231239
Set-ItemProperty -Path "Registry::$refreshPath" -Name "Position" -Value "Bottom"
232-
233-
$psSched = "PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Schedule`\""
240+
241+
# $psSched = "PowerShell.exe -ExecutionPolicy Bypass -NoProfile -Command `\"& '$AutoThemeScript' -Schedule`\""
234242
Set-ItemProperty -Path "Registry::$refreshPath\command" -Name "(Default)" -Value $psSched
235243

236244
Write-Log "Cascading menu reordered: Refresh is now at the bottom."

at.ps1

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Changes the active Windows theme based on a predefined/daylight schedule. Works in Windows 10/11.
44
@@ -20,16 +20,7 @@
2020
https://github.com/unalignedcoder/auto-theme/
2121
2222
.NOTES
23-
MAJOR UPDATE:
24-
- Added parameters to control script functions
25-
- Added the ability to move the slideshow to the next wallpaper
26-
- Added a native OFFLINE sunrise/sunset calculation system
27-
- Added a Desktop CONTEXT MENU to control the slideshow or theme
28-
- Fixed a problem where wallpapers would not change if a task was created without the need to change theme
29-
- Fixed geolocation (again)
30-
- Added verification of the config file to the setup script
31-
- Improved the Rainmeter sample skin
32-
- Many minor fixes
23+
- Fixed a parsing error in the Setup script
3324
#>
3425

3526
# ============ Script Parameters ==============
@@ -43,7 +34,7 @@ param (
4334
# ============= Script Version ==============
4435

4536
# This is automatically updated
46-
$scriptVersion = "1.0.45"
37+
$scriptVersion = "1.0.46"
4738

4839
# ============= Config file ==============
4940

@@ -649,7 +640,7 @@ param (
649640
$newColor = if ($ThemeMode -eq "dark") { 16777215 } else { 0 }
650641

651642
# Portable Mode Method
652-
643+
653644
if ($tClockPath -and (Test-Path $tClockPath)) {
654645

655646
$iniPath = Join-Path (Split-Path -Parent $tClockPath) "T-Clock.ini"
@@ -696,7 +687,7 @@ param (
696687
Write-Log "Registry update failed: $_"
697688
}
698689
}
699-
}
690+
}
700691
}
701692

702693
# Restart T-Clock
@@ -866,16 +857,16 @@ param (
866857
function Invoke-AsAdmin {
867858
if (-Not (Test-IsAdmin)) {
868859
Write-Log "Requesting elevation. Forwarding parameters..." -verboseMessage $true
869-
860+
870861
# We use $script:PSBoundParameters to reach outside the function's scope
871862
$paramsToPass = $script:PSBoundParameters.Keys | ForEach-Object { "-$_" }
872-
863+
873864
$argList = @("-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "`"$PSCommandPath`"") + $paramsToPass
874865

875866
try {
876867
# Added -WindowStyle Hidden here to keep the secondary window from "flashing"
877868
Start-Process -FilePath "powershell.exe" -ArgumentList $argList -Verb RunAs -WindowStyle Hidden
878-
exit 0
869+
exit 0
879870
} catch {
880871
Write-Log "Elevation failed: $_" -Level Error
881872
exit 1
@@ -1594,18 +1585,18 @@ try {
15941585
$wallPath = if ($isLight) { $wallLightPath } else { $wallDarkPath }
15951586

15961587
& $workerPath -Path $wallPath -InformationAction Continue
1597-
1588+
15981589
# we can reset the task to restart the timer only if admin
15991590
if (Test-IsAdmin) {
16001591
Set-WallpaperRotationTask -Mode $mode
16011592
Write-Log "Rotation timer reset successfully." -verboseMessage $true
16021593
} else {
16031594
Write-Log "Skipped timer reset (Admin rights required)." -verboseMessage $true
16041595
}
1605-
1596+
16061597
exit 0
16071598
}
1608-
1599+
16091600
# Make sure we are Admin
16101601
if ($forceAsAdmin) {
16111602
Write-Log "Running as Administrator." -verboseMessage $true
@@ -1656,5 +1647,6 @@ try {
16561647
Write-Log "" -verboseMessage $true
16571648

16581649
} catch {
1650+
16591651
Write-Log "Error: $_"
1660-
}
1652+
}

0 commit comments

Comments
 (0)