1- <#
1+ <#
22. SYNOPSIS
33 Changes the active Windows theme based on a predefined/daylight schedule. Works in Windows 10/11.
44
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