Browse Source

Update Download_Sophia.ps1

pull/401/head
Dmitry Nefedov 2 years ago
committed by GitHub
parent
commit
06a315c643
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      Download_Sophia.ps1

24
Download_Sophia.ps1

@ -72,7 +72,7 @@ if ($Wrapper)
Start-Sleep -Second 1 Start-Sleep -Second 1
Invoke-Item -Path "$DownloadsFolder\Sophia Script Wrapper v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_Wrapper_v$LatestRelease"
} }
switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
@ -204,38 +204,38 @@ switch ($Version)
{ {
"Wrapper" "Wrapper"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script Wrapper v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_Wrapper_v$LatestRelease"
} }
"LTSC2019" "LTSC2019"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 LTSC 2019 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2019_v$LatestRelease"
} }
"LTSC2021" "LTSC2021"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 LTSC 2021 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_LTSC_2021_v$LatestRelease"
} }
"Windows_10_PowerShell_5.1" "Windows_10_PowerShell_5.1"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_v$LatestRelease"
} }
"Windows_10_PowerShell_7" "Windows_10_PowerShell_7"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 10 PowerShell 7 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_10_PowerShell_7_v$LatestRelease"
} }
"Windows_11_PowerShell_5.1" "Windows_11_PowerShell_5.1"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 11 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_v$LatestRelease"
} }
"Windows_11_PowerShell_7" "Windows_11_PowerShell_7"
{ {
Invoke-Item -Path "$DownloadsFolder\Sophia Script for Windows 11 PowerShell 7 v$LatestRelease" Invoke-Item -Path "$DownloadsFolder\Sophia_Script_for_Windows_11_PowerShell_7_v$LatestRelease"
} }
} }
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -251,7 +251,7 @@ if (-not ("WinAPI.ForegroundWindow" -as [type]))
Start-Sleep -Seconds 1 Start-Sleep -Seconds 1
Get-Process -Name explorer | Where-Object -FilterScript {$_.MainWindowTitle -match "Sophia Script for Windows $([System.Environment]::OSVersion.Version.Major)"} | ForEach-Object -Process { Get-Process -Name explorer | Where-Object -FilterScript {$_.MainWindowTitle -match "Sophia_Script_for_Windows_$([System.Environment]::OSVersion.Version.Major)"} | ForEach-Object -Process {
# Show window, if minimized # Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 5) [WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 5)

Loading…
Cancel
Save