From 2ff79a85db3efc31e118fc575352d226e0fd07a5 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Fri, 2 Feb 2024 21:58:17 +0300 Subject: [PATCH 1/5] Update Download_Sophia.ps1 --- Download_Sophia.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index cb591e682..d810ec56f 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -204,7 +204,16 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } if (-not ("WinAPI.ForegroundWindow" -as [type])) { - Add-Type @SetForegroundWindow + try + { + Add-Type @Signature + } + catch [System.ComponentModel.Win32Exception] + { + Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase." + + exit + } } Start-Sleep -Seconds 1 From 01f2d945f8b9287153bd11f957c3647cf4de36e9 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Fri, 2 Feb 2024 22:17:04 +0300 Subject: [PATCH 2/5] Update Download_Sophia.ps1 --- Download_Sophia.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index d810ec56f..9b1ef7ac1 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -208,7 +208,7 @@ if (-not ("WinAPI.ForegroundWindow" -as [type])) { Add-Type @Signature } - catch [System.ComponentModel.Win32Exception] + catch [System.Management.Automation.ParameterBindingValidationException] { Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase." From 7efb3a7751bc780cb0faa388dfbdc127f28b0dab Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Fri, 2 Feb 2024 22:45:37 +0300 Subject: [PATCH 3/5] Update Download_Sophia.ps1 --- Download_Sophia.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index 9b1ef7ac1..93e2cee18 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -208,7 +208,7 @@ if (-not ("WinAPI.ForegroundWindow" -as [type])) { Add-Type @Signature } - catch [System.Management.Automation.ParameterBindingValidationException] + catch [System.Management.Automation.ParameterBindingException] { Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase." From 1f6467166364305b906a23c403944d102122cde1 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Fri, 2 Feb 2024 22:47:06 +0300 Subject: [PATCH 4/5] Update Download_Sophia.ps1 --- Download_Sophia.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index 93e2cee18..ea364cdc4 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -211,8 +211,6 @@ if (-not ("WinAPI.ForegroundWindow" -as [type])) catch [System.Management.Automation.ParameterBindingException] { Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase." - - exit } } From 7c65045f368fe97d3f2d284d3a2c63b22ee8dfc7 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Fri, 2 Feb 2024 22:53:31 +0300 Subject: [PATCH 5/5] Update Download_Sophia.ps1 --- Download_Sophia.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index ea364cdc4..6f7dbd46e 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -210,7 +210,7 @@ if (-not ("WinAPI.ForegroundWindow" -as [type])) } catch [System.Management.Automation.ParameterBindingException] { - Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase." + Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Ignore this error message. Open background folder manually." } }