diff --git a/Wrapper/Config/config_Windows_11.json b/Wrapper/Config/config_Windows_11.json index df146e3f..ee125067 100644 --- a/Wrapper/Config/config_Windows_11.json +++ b/Wrapper/Config/config_Windows_11.json @@ -2016,6 +2016,22 @@ "Preset": "Zero", "WindowsDefault": "One" }, + { + "Region": "Context menu", + "Control": "cmb", + "Required": "false", + "Function": "EditWithPaintContext", + "Arg": { + "Zero": { + "Tag": "Hide" + }, + "One": { + "Tag": "Show" + } + }, + "Preset": "Zero", + "WindowsDefault": "One" + }, { "Region": "Context menu", "Control": "cmb", diff --git a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json index 216dd6f8..1968792a 100644 --- a/Wrapper/Localizations/de-DE/tooltip_Windows_11.json +++ b/Wrapper/Localizations/de-DE/tooltip_Windows_11.json @@ -1775,6 +1775,20 @@ } } }, + { + "Region": "Context menu", + "Function": "EditWithPaintContext", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Eintrag \"Mit Paint bearbeiten\" im Kontextmenü ausblenden." + }, + "One": { + "Tag": "Show", + "ToolTip": "Eintrag \"Mit Paint bearbeiten\" im Kontextmenü anzeigen (Standardwert)." + } + } + }, { "Region": "Context menu", "Function": "PrintCMDContext", diff --git a/Wrapper/Localizations/en-US/tooltip_Windows_11.json b/Wrapper/Localizations/en-US/tooltip_Windows_11.json index ce0eaa6f..a97fec56 100644 --- a/Wrapper/Localizations/en-US/tooltip_Windows_11.json +++ b/Wrapper/Localizations/en-US/tooltip_Windows_11.json @@ -1775,6 +1775,20 @@ } } }, + { + "Region": "Context menu", + "Function": "EditWithPaintContext", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Hide the \"Edit with Paint\" item from the media files context menu." + }, + "One": { + "Tag": "Show", + "ToolTip": "Show the \"Edit with Paint\" item in the media files context menu (default value)." + } + } + }, { "Region": "Context menu", "Function": "PrintCMDContext", diff --git a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json index 48358996..4ef7c3c5 100644 --- a/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json +++ b/Wrapper/Localizations/ru-RU/tooltip_Windows_11.json @@ -1775,6 +1775,20 @@ } } }, + { + "Region": "Context menu", + "Function": "EditWithPaintContext", + "Arg": { + "Zero": { + "Tag": "Hide", + "ToolTip": "Скрыть пункт \"Изменить с помощью приложения Paint\" из контекстного меню медиа-файлов." + }, + "One": { + "Tag": "Show", + "ToolTip": "Отобразить пункт \"Изменить с помощью приложения Paint\" в контекстном меню медиа-файлов (значение по умолчанию)." + } + } + }, { "Region": "Context menu", "Function": "PrintCMDContext", diff --git a/Wrapper/SophiaScriptWrapper.exe b/Wrapper/SophiaScriptWrapper.exe index a743592b..c4c3c900 100644 Binary files a/Wrapper/SophiaScriptWrapper.exe and b/Wrapper/SophiaScriptWrapper.exe differ diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index f2bc6d8b..6c2ef84c 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -13516,6 +13516,72 @@ function EditWithPhotosContext } } +<# + .SYNOPSIS + The "Edit with Paint" item in the media files context menu + + .PARAMETER Hide + Hide the "Edit with Paint" item from the media files context menu + + .PARAMETER Show + Show the "Edit with Paint" item in the media files context menu + + .EXAMPLE + EditWithPaintContext -Hide + + .EXAMPLE + EditWithPaintContext -Show + + .NOTES + Current user +#> +function EditWithPaintContext +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Hide" + )] + [switch] + $Hide, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Show" + )] + [switch] + $Show + ) + + if (-not (Get-AppxPackage -Name Microsoft.Paint)) + { + Write-Information -MessageData "" -InformationAction Continue + Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose + Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue + + return + } + + Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -Force -ErrorAction Ignore + + switch ($PSCmdlet.ParameterSetName) + { + "Hide" + { + if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked")) + { + New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force + } + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -PropertyType String -Value "" -Force + } + "Show" + { + Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -Force -ErrorAction Ignore + } + } +} + <# .SYNOPSIS The "Print" item in the .bat and .cmd context menu diff --git a/src/Sophia_Script_for_Windows_11/Sophia.ps1 b/src/Sophia_Script_for_Windows_11/Sophia.ps1 index 3117a934..f9b8a48e 100644 --- a/src/Sophia_Script_for_Windows_11/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11/Sophia.ps1 @@ -1276,6 +1276,14 @@ EditWithPhotosContext -Hide # Отобразить пункт "Изменить с помощью приложения "Фотографии"" в контекстном меню (значение по умолчанию) # EditWithPhotosContext -Show +# Hide the "Edit with Paint" item from the media files context menu +# Скрыть пункт "Изменить с помощью приложения "Paint"" из контекстного меню +EditWithPaintContext -Hide + +# Show the "Edit with Paint" item in the media files context menu (default value) +# Отобразить пункт "Изменить с помощью приложения "Paint"" в контекстном меню (значение по умолчанию) +# EditWithPaintContext -Show + # Hide the "Print" item from the .bat and .cmd context menu # Скрыть пункт "Печать" из контекстного меню .bat и .cmd файлов PrintCMDContext -Hide diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index 6514216d..ef810c82 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -13546,6 +13546,72 @@ function EditWithPhotosContext } } +<# + .SYNOPSIS + The "Edit with Paint" item in the media files context menu + + .PARAMETER Hide + Hide the "Edit with Paint" item from the media files context menu + + .PARAMETER Show + Show the "Edit with Paint" item in the media files context menu + + .EXAMPLE + EditWithPaintContext -Hide + + .EXAMPLE + EditWithPaintContext -Show + + .NOTES + Current user +#> +function EditWithPaintContext +{ + param + ( + [Parameter( + Mandatory = $true, + ParameterSetName = "Hide" + )] + [switch] + $Hide, + + [Parameter( + Mandatory = $true, + ParameterSetName = "Show" + )] + [switch] + $Show + ) + + if (-not (Get-AppxPackage -Name Microsoft.Paint)) + { + Write-Information -MessageData "" -InformationAction Continue + Write-Verbose -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -Verbose + Write-Error -Message ($Localization.Skipped -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue + + return + } + + Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -Force -ErrorAction Ignore + + switch ($PSCmdlet.ParameterSetName) + { + "Hide" + { + if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked")) + { + New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force + } + New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -PropertyType String -Value "" -Force + } + "Show" + { + Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{2430F218-B743-4FD6-97BF-5C76541B4AE9}" -Force -ErrorAction Ignore + } + } +} + <# .SYNOPSIS The "Print" item in the .bat and .cmd context menu diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 index b28851c9..f846ef58 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 @@ -1280,6 +1280,14 @@ EditWithPhotosContext -Hide # Отобразить пункт "Изменить с помощью приложения "Фотографии"" в контекстном меню (значение по умолчанию) # EditWithPhotosContext -Show +# Hide the "Edit with Paint" item from the media files context menu +# Скрыть пункт "Изменить с помощью приложения "Paint"" из контекстного меню +EditWithPaintContext -Hide + +# Show the "Edit with Paint" item in the media files context menu (default value) +# Отобразить пункт "Изменить с помощью приложения "Paint"" в контекстном меню (значение по умолчанию) +# EditWithPaintContext -Show + # Hide the "Print" item from the .bat and .cmd context menu # Скрыть пункт "Печать" из контекстного меню .bat и .cmd файлов PrintCMDContext -Hide