Skip to content

Commit df351f2

Browse files
committed
Check for Update relaunch behavior
Will now properly check and relaunch the app via the .vbs script within the same directory of the .ps1.
1 parent dbf0670 commit df351f2

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Spreadsheet Wrangler
22

3-
[![Version](https://img.shields.io/badge/version-1.8.2-blue.svg)](https://github.com/BryantWelch/Spreadsheet-Wrangler/releases/tag/v1.8.2)
3+
[![Version](https://img.shields.io/badge/version-1.8.3-blue.svg)](https://github.com/BryantWelch/Spreadsheet-Wrangler/releases/tag/v1.8.3)
44
[![PowerShell](https://img.shields.io/badge/PowerShell-5.1+-5391FE.svg)](https://github.com/PowerShell/PowerShell)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![Platform](https://img.shields.io/badge/platform-Windows-lightgrey.svg)](https://www.microsoft.com/en-us/windows)

SpreadsheetWrangler.ps1

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ $aboutMenuItem.Add_Click({
19371937

19381938
# Main about text
19391939
$aboutLabel = New-Object System.Windows.Forms.Label
1940-
$aboutLabel.Text = "Spreadsheet Wrangler v1.8.2`n`nA powerful tool for backing up folders and combining spreadsheets.`n`nCreated by Bryant Welch`nCreated: $(Get-Date -Format 'yyyy-MM-dd')`n`n(c) 2025 Bryant Welch. All Rights Reserved"
1940+
$aboutLabel.Text = "Spreadsheet Wrangler v1.8.3`n`nA powerful tool for backing up folders and combining spreadsheets.`n`nCreated by Bryant Welch`nCreated: $(Get-Date -Format 'yyyy-MM-dd')`n`n(c) 2025 Bryant Welch. All Rights Reserved"
19411941
$aboutLabel.AutoSize = $false
19421942
$aboutLabel.Dock = "Fill"
19431943
$aboutLabel.TextAlign = "MiddleCenter"
@@ -2706,7 +2706,7 @@ function Check-ForUpdates {
27062706
Write-Log "Checking for updates..." "Cyan"
27072707

27082708
# Current version (from the app)
2709-
$currentVersion = "1.8.2" # This should match the version in the about dialog
2709+
$currentVersion = "1.8.3" # This should match the version in the about dialog
27102710

27112711
# Get the latest release info from GitHub API
27122712
$apiUrl = "https://api.github.com/repos/BryantWelch/Spreadsheet-Wrangler/releases/latest"
@@ -2717,7 +2717,7 @@ function Check-ForUpdates {
27172717
"User-Agent" = "PowerShell Script"
27182718
}
27192719

2720-
# Extract version number from tag (assuming format like "v1.8.2")
2720+
# Extract version number from tag (assuming format like "v1.8.3")
27212721
$latestVersion = $response.tag_name -replace 'v', ''
27222722

27232723
Write-Log "Current version: $currentVersion" "White"
@@ -2809,6 +2809,17 @@ function Update-Application {
28092809

28102810
# Get the current script path
28112811
$currentScriptPath = $PSCommandPath
2812+
$scriptDirectory = [System.IO.Path]::GetDirectoryName($currentScriptPath)
2813+
$vbsPath = [System.IO.Path]::Combine($scriptDirectory, "Launch-SpreadsheetWrangler.vbs")
2814+
2815+
# Determine how to restart - use VBS if it exists, otherwise direct PowerShell
2816+
$restartCommand = 'start powershell -NoProfile -ExecutionPolicy Bypass -File "' + $currentScriptPath + '"'
2817+
if (Test-Path $vbsPath) {
2818+
$restartCommand = 'start "" "' + $vbsPath + '"'
2819+
Write-Log "Will restart using VBS launcher: $vbsPath" "White"
2820+
} else {
2821+
Write-Log "Will restart using PowerShell directly" "White"
2822+
}
28122823

28132824
# Create update batch file to replace the script after this process exits
28142825
$batchFile = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "update_spreadsheet_wrangler.bat")
@@ -2818,7 +2829,7 @@ function Update-Application {
28182829
@echo off
28192830
timeout /t 2 /nobreak > nul
28202831
copy /Y "$tempFile" "$currentScriptPath"
2821-
start powershell -NoProfile -ExecutionPolicy Bypass -File "$currentScriptPath"
2832+
$restartCommand
28222833
del "%~f0"
28232834
exit
28242835
"@
@@ -3100,7 +3111,7 @@ Load-AppSettings
31003111
Update-RecentFilesMenu
31013112

31023113
# Display welcome and helpful information
3103-
Write-Log "=== Spreadsheet Wrangler v1.8.2 ===" "Cyan"
3114+
Write-Log "=== Spreadsheet Wrangler v1.8.3 ===" "Cyan"
31043115
Write-Log "Application initialized and ready to use." "Green"
31053116

31063117
# Getting started section

0 commit comments

Comments
 (0)