Browse Source

Imroved scheduled tasks toast notifications

pull/429/head
Dmitry Nefedov 1 year ago
parent
commit
ebfafd66c3
  1. 33
      Wrapper/Config/config_Windows_11.json
  2. 37
      Wrapper/Localizations/de-DE/tooltip_Windows_11.json
  3. 37
      Wrapper/Localizations/en-US/tooltip_Windows_11.json
  4. 37
      Wrapper/Localizations/ru-RU/tooltip_Windows_11.json
  5. 24
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  6. 24
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  7. 24
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  8. 24
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  9. 106
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  10. 8
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  11. 116
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  12. 8
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

33
Wrapper/Config/config_Windows_11.json

@ -2136,7 +2136,7 @@
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "PrintCMDContext",
"Function": "EditWithClipchampContext",
"Arg": {
"Zero": {
"Tag": "Hide"
@ -2153,7 +2153,7 @@
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "IncludeInLibraryContext",
"Function": "PrintCMDContext",
"Arg": {
"Zero": {
"Tag": "Hide"
@ -2170,7 +2170,7 @@
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "SendToContext",
"Function": "IncludeInLibraryContext",
"Arg": {
"Zero": {
"Tag": "Hide"
@ -2187,7 +2187,7 @@
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "CompressedFolderNewContext",
"Function": "SendToContext",
"Arg": {
"Zero": {
"Tag": "Hide"
@ -2204,6 +2204,23 @@
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "CompressedFolderNewContext",
"Arg": {
"Zero": {
"Tag": "Hide"
},
"One": {
"Tag": "Show"
}
},
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Id": 1210,
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
"Function": "MultipleInvokeContext",
"Arg": {
"Zero": {
@ -2217,7 +2234,7 @@
"WindowsDefault": "One"
},
{
"Id": 1210,
"Id": 1211,
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
@ -2234,7 +2251,7 @@
"WindowsDefault": "One"
},
{
"Id": 1211,
"Id": 1212,
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
@ -2251,7 +2268,7 @@
"WindowsDefault": "Show"
},
{
"Id": 1212,
"Id": 1213,
"Region": "Context menu",
"Control": "cmb",
"Required": "false",
@ -2268,7 +2285,7 @@
"WindowsDefault": "One"
},
{
"Id": 1213,
"Id": 1214,
"Region": "Context menu",
"Control": "cmb",
"Required": "false",

37
Wrapper/Localizations/de-DE/tooltip_Windows_11.json

@ -1887,36 +1887,21 @@
{
"Id": 1205,
"Region": "Context menu",
"Function": "EditWithPhotosContext",
"Function": "EditWithClipchampContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Eintrag \"Mit Fotos bearbeiten\" im Kontextmenü von Mediendateien ausblenden"
"ToolTip": "Eintrag \"Mit Clipchamp bearbeiten\" im Kontextmenü ausblenden"
},
"One": {
"Tag": "Show",
"ToolTip": "Eintrag \"Mit Fotos bearbeiten\" im Kontextmenü von Mediendateien aunzeigen (Standardeinstellung)"
"ToolTip": "Eintrag \"Mit Clipchamp bearbeiten\" im Kontextmenü anzeigen (Standardeinstellung)"
}
}
},
{
"Id": 1206,
"Region": "Context menu",
"Function": "CreateANewVideoContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Eintrag \"Neues Video erstellen\" im Kontextmenü der Mediendateien ausblenden"
},
"One": {
"Tag": "Show",
"ToolTip": "Eintrag \"Neues Video erstellen\" im Kontextmenü der Mediendateien aunzeigen (Standardeinstellung)"
}
}
},
{
"Id": 1207,
"Region": "Context menu",
"Function": "PrintCMDContext",
"Arg": {
"Zero": {
@ -1930,7 +1915,7 @@
}
},
{
"Id": 1208,
"Id": 1207,
"Region": "Context menu",
"Function": "IncludeInLibraryContext",
"Arg": {
@ -1945,7 +1930,7 @@
}
},
{
"Id": 1209,
"Id": 1208,
"Region": "Context menu",
"Function": "SendToContext",
"Arg": {
@ -1960,7 +1945,7 @@
}
},
{
"Id": 1210,
"Id": 1209,
"Region": "Context menu",
"Function": "CompressedFolderNewContext",
"Arg": {
@ -1975,7 +1960,7 @@
}
},
{
"Id": 1211,
"Id": 1210,
"Region": "Context menu",
"Function": "MultipleInvokeContext",
"Arg": {
@ -1990,7 +1975,7 @@
}
},
{
"Id": 1212,
"Id": 1211,
"Region": "Context menu",
"Function": "UseStoreOpenWith",
"Arg": {
@ -2005,7 +1990,7 @@
}
},
{
"Id": 1213,
"Id": 1212,
"Region": "Context menu",
"Function": "OpenWindowsTerminalContext",
"Arg": {
@ -2020,7 +2005,7 @@
}
},
{
"Id": 1214,
"Id": 1213,
"Region": "Context menu",
"Function": "OpenWindowsTerminalAdminContext",
"Arg": {
@ -2035,7 +2020,7 @@
}
},
{
"Id": 1215,
"Id": 1214,
"Region": "Context menu",
"Function": "Windows10ContextMenu",
"Arg": {

37
Wrapper/Localizations/en-US/tooltip_Windows_11.json

@ -1887,36 +1887,21 @@
{
"Id": 1205,
"Region": "Context menu",
"Function": "EditWithPhotosContext",
"Function": "EditWithClipchampContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Hide the \"Edit with Photos\" item from the media files context menu"
"ToolTip": "Hide the \"Edit with Clipchamp\" item from the media files context menu"
},
"One": {
"Tag": "Show",
"ToolTip": "Show the \"Edit with Photos\" item in the media files context menu (default value)"
"ToolTip": "Show the \"Edit with Clipchamp\" item in the media files context menu (default value)"
}
}
},
{
"Id": 1206,
"Region": "Context menu",
"Function": "CreateANewVideoContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Hide the \"Create a new video\" item in the media files context menu"
},
"One": {
"Tag": "Show",
"ToolTip": "Show the \"Create a new video\" item in the media files context menu (default value)"
}
}
},
{
"Id": 1207,
"Region": "Context menu",
"Function": "PrintCMDContext",
"Arg": {
"Zero": {
@ -1930,7 +1915,7 @@
}
},
{
"Id": 1208,
"Id": 1207,
"Region": "Context menu",
"Function": "IncludeInLibraryContext",
"Arg": {
@ -1945,7 +1930,7 @@
}
},
{
"Id": 1209,
"Id": 1208,
"Region": "Context menu",
"Function": "SendToContext",
"Arg": {
@ -1960,7 +1945,7 @@
}
},
{
"Id": 1210,
"Id": 1209,
"Region": "Context menu",
"Function": "CompressedFolderNewContext",
"Arg": {
@ -1975,7 +1960,7 @@
}
},
{
"Id": 1211,
"Id": 1210,
"Region": "Context menu",
"Function": "MultipleInvokeContext",
"Arg": {
@ -1990,7 +1975,7 @@
}
},
{
"Id": 1212,
"Id": 1211,
"Region": "Context menu",
"Function": "UseStoreOpenWith",
"Arg": {
@ -2005,7 +1990,7 @@
}
},
{
"Id": 1213,
"Id": 1212,
"Region": "Context menu",
"Function": "OpenWindowsTerminalContext",
"Arg": {
@ -2020,7 +2005,7 @@
}
},
{
"Id": 1214,
"Id": 1213,
"Region": "Context menu",
"Function": "OpenWindowsTerminalAdminContext",
"Arg": {
@ -2035,7 +2020,7 @@
}
},
{
"Id": 1215,
"Id": 1214,
"Region": "Context menu",
"Function": "Windows10ContextMenu",
"Arg": {

37
Wrapper/Localizations/ru-RU/tooltip_Windows_11.json

@ -1887,36 +1887,21 @@
{
"Id": 1205,
"Region": "Context menu",
"Function": "EditWithPhotosContext",
"Function": "EditWithClipchampContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Скрыть пункт \"Изменить с помощью приложения \"Фотографии\"\" из контекстного меню медиа-файлов"
"ToolTip": "Скрыть пункт \"Редактировать в Climpchamp\" из контекстного меню медиа-файлов"
},
"One": {
"Tag": "Show",
"ToolTip": "Показывать пункт \"Изменить с помощью приложения \"Фотографии\"\" в контекстном меню медиа-файлов (значение по умолчанию)"
"ToolTip": "Показывать пункт \"Редактировать в Climpchamp\" в контекстном меню медиа-файлов (значение по умолчанию)"
}
}
},
{
"Id": 1206,
"Region": "Context menu",
"Function": "CreateANewVideoContext",
"Arg": {
"Zero": {
"Tag": "Hide",
"ToolTip": "Скрыть пункт \"Создать новое видео\" из контекстного меню медиа-файлов"
},
"One": {
"Tag": "Show",
"ToolTip": "Показывать пункт \"Создать новое видео\" в контекстном меню медиа-файлов (значение по умолчанию)"
}
}
},
{
"Id": 1207,
"Region": "Context menu",
"Function": "PrintCMDContext",
"Arg": {
"Zero": {
@ -1930,7 +1915,7 @@
}
},
{
"Id": 1208,
"Id": 1207,
"Region": "Context menu",
"Function": "IncludeInLibraryContext",
"Arg": {
@ -1945,7 +1930,7 @@
}
},
{
"Id": 1209,
"Id": 1208,
"Region": "Context menu",
"Function": "SendToContext",
"Arg": {
@ -1960,7 +1945,7 @@
}
},
{
"Id": 1210,
"Id": 1209,
"Region": "Context menu",
"Function": "CompressedFolderNewContext",
"Arg": {
@ -1975,7 +1960,7 @@
}
},
{
"Id": 1211,
"Id": 1210,
"Region": "Context menu",
"Function": "MultipleInvokeContext",
"Arg": {
@ -1990,7 +1975,7 @@
}
},
{
"Id": 1212,
"Id": 1211,
"Region": "Context menu",
"Function": "UseStoreOpenWith",
"Arg": {
@ -2005,7 +1990,7 @@
}
},
{
"Id": 1213,
"Id": 1212,
"Region": "Context menu",
"Function": "OpenWindowsTerminalContext",
"Arg": {
@ -2020,7 +2005,7 @@
}
},
{
"Id": 1214,
"Id": 1213,
"Region": "Context menu",
"Function": "OpenWindowsTerminalAdminContext",
"Arg": {
@ -2035,7 +2020,7 @@
}
},
{
"Id": 1215,
"Id": 1214,
"Region": "Context menu",
"Function": "Windows10ContextMenu",
"Arg": {

24
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -11256,6 +11256,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -11567,12 +11577,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -11720,12 +11725,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />

24
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -7904,6 +7904,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -8215,12 +8225,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -8368,12 +8373,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />

24
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -9071,6 +9071,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -9382,12 +9392,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -9535,12 +9540,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />

24
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -11284,6 +11284,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -11595,12 +11605,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -11748,12 +11753,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />

106
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -3,7 +3,7 @@
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.4
Date: 21.11.2022
Date: 26.11.2022
Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic
@ -3792,7 +3792,7 @@ public static bool MarkFileDelete (string sourcefile)
}
# If there are some files or folders left in %OneDrive%
if ((Get-ChildItem -Path $env:OneDrive -Force | Measure-Object).Count -ne 0)
if ((Get-ChildItem -Path $env:OneDrive -ErrorAction Ignore | Measure-Object).Count -ne 0)
{
if (-not ("WinAPI.DeleteFiles" -as [type]))
{
@ -4247,7 +4247,7 @@ function TempFolder
}
# If there are some files or folders left in %LOCALAPPDATA\Temp%
if ((Get-ChildItem -Path $env:TEMP -Force | Measure-Object).Count -ne 0)
if ((Get-ChildItem -Path $env:TEMP -Force -ErrorAction Ignore | Measure-Object).Count -ne 0)
{
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexa
# The system does not move the file until the operating system is restarted
@ -4363,7 +4363,7 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Remove-Item -Path $((Get-Item -Path $env:TEMP).FullName) -Recurse -Force -ErrorAction Ignore
if ((Get-ChildItem -Path $env:TEMP -Force | Measure-Object).Count -ne 0)
if ((Get-ChildItem -Path $env:TEMP -Force -ErrorAction Ignore | Measure-Object).Count -ne 0)
{
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexa
# The system does not move the file until the operating system is restarted
@ -10662,6 +10662,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -10973,12 +10983,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -11126,12 +11131,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -12311,6 +12311,64 @@ function ShareContext
}
}
<#
.SYNOPSIS
The "Edit with Clipchamp" item in the media files context menu
.PARAMETER Hide
Hide the "Edit with Clipchamp" item from the media files context menu
.PARAMETER Show
Show the "Edit with Clipchamp" item in the media files context menu
.EXAMPLE
EditWithClipchampContext -Hide
.EXAMPLE
EditWithClipchampContext -Show
.NOTES
Current user
#>
function EditWithClipchampContext
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Hide"
)]
[switch]
$Hide,
[Parameter(
Mandatory = $true,
ParameterSetName = "Show"
)]
[switch]
$Show
)
if (((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber -ge 22621) -and (Get-AppxPackage -Name Clipchamp.Clipchamp))
{
switch ($PSCmdlet.ParameterSetName)
{
"Hide"
{
if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{8AB635F8-9A67-4698-AB99-784AD929F3B4}" -PropertyType String -Value "Play to menu" -Force
}
"Show"
{
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{8AB635F8-9A67-4698-AB99-784AD929F3B4}" -Force -ErrorAction Ignore
}
}
}
}
<#
.SYNOPSIS
The "Print" item in the .bat and .cmd context menu
@ -13060,6 +13118,12 @@ public static void PostMessage()
}
}
if ($Script:RegionChanged)
{
# Set the original region ID
Set-WinHomeLocation -GeoId $Script:Region
}
# Persist Sophia notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia))
{
@ -13174,16 +13238,6 @@ public static void PostMessage()
gpupdate /force
}
# [WinAPI.UpdateEnvironment]::Refresh() makes so that Meet Now icon returns even if was hid before, so we need to check which function was called previously
if ($Script:MeetNow)
{
MeetNow -Show
}
elseif ($Script:MeetNow -eq $false)
{
MeetNow -Hide
}
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore

8
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -1265,6 +1265,14 @@ ShareContext -Hide
# Отобразить пункт "Отправить" (поделиться) в контекстном меню (значение по умолчанию)
# ShareContext -Show
# Hide the "Edit with Clipchamp" item from the media files context menu
# Скрыть пункт "Редактировать в Climpchamp" из контекстного меню
EditWithClipchampContext -Hide
# Show the "Edit with Clipchamp" item in the media files context menu (default value)
# Отобразить пункт "Редактировать в Climpchamp" в контекстном меню (значение по умолчанию)
# EditWithClipchampContext -Show
# Hide the "Print" item from the .bat and .cmd context menu
# Скрыть пункт "Печать" из контекстного меню .bat и .cmd файлов
PrintCMDContext -Hide

116
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.3
Date: 21.11.2022
Version: v6.2.4
Date: 26.11.2022
Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic
@ -3752,7 +3752,7 @@ function OneDrive
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveUninstalling -Verbose
Stop-Process -Name OneDrive, FileCoAuth -Force -ErrorAction Ignore
Stop-Process -Name OneDrive, OneDriveSetup, FileCoAuth -Force -ErrorAction Ignore
# Getting link to the OneDriveSetup.exe and its' argument(s)
[string[]]$OneDriveSetup = ($UninstallString -Replace("\s*/", ",/")).Split(",").Trim()
@ -3768,7 +3768,7 @@ function OneDrive
# Get the OneDrive user folder path and remove it if it doesn't contain any user files
if (Test-Path -Path $env:OneDrive)
{
if ((Get-ChildItem -Path $env:OneDrive | Measure-Object).Count -eq 0)
if ((Get-ChildItem -Path $env:OneDrive -ErrorAction Ignore | Measure-Object).Count -eq 0)
{
Remove-Item -Path $env:OneDrive -Recurse -Force -ErrorAction Ignore
@ -4246,7 +4246,7 @@ function TempFolder
# Cleaning up folders
Remove-Item -Path $env:SystemRoot\Temp -Recurse -Force -ErrorAction Ignore
Get-Item -Path $env:TEMP -Force -ErrorAction Ignore | Where-Object -FilterScript {$_.LinkType -ne "SymbolicLink"} | Remove-Item -Recurse -Force -ErrorAction Ignore
Get-Item -Path $env:TEMP -Force | Where-Object -FilterScript {$_.LinkType -ne "SymbolicLink"} | Remove-Item -Recurse -Force -ErrorAction Ignore
if (-not (Test-Path -Path $env:LOCALAPPDATA\Temp))
{
@ -10690,6 +10690,16 @@ function CleanupTask
{
"Register"
{
# Checking if notifications and Action Center are disabled
if
(
((Get-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1) -or
((Get-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -ErrorAction Ignore).DisableNotificationCenter -eq 1)
)
{
return
}
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folders do not exist
@ -11001,12 +11011,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.SoftwareDistributionTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -11154,12 +11159,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
<toast duration="""Long""">
<visual>
<binding template="""ToastGeneric""">
<text>$($Localization.TaskNotificationTitle)</text>
<group>
<subgroup>
<text hint-style="""body""" hint-wrap="""true""">$($Localization.TempTaskNotificationEvent)</text>
</subgroup>
</group>
<text>$($Localization.TempTaskNotificationEvent)</text>
</binding>
</visual>
<audio src="""ms-winsoundevent:notification.default""" />
@ -12339,6 +12339,64 @@ function ShareContext
}
}
<#
.SYNOPSIS
The "Edit with Clipchamp" item in the media files context menu
.PARAMETER Hide
Hide the "Edit with Clipchamp" item from the media files context menu
.PARAMETER Show
Show the "Edit with Clipchamp" item in the media files context menu
.EXAMPLE
EditWithClipchampContext -Hide
.EXAMPLE
EditWithClipchampContext -Show
.NOTES
Current user
#>
function EditWithClipchampContext
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Hide"
)]
[switch]
$Hide,
[Parameter(
Mandatory = $true,
ParameterSetName = "Show"
)]
[switch]
$Show
)
if (((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber -ge 22621) -and (Get-AppxPackage -Name Clipchamp.Clipchamp))
{
switch ($PSCmdlet.ParameterSetName)
{
"Hide"
{
if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{8AB635F8-9A67-4698-AB99-784AD929F3B4}" -PropertyType String -Value "Play to menu" -Force
}
"Show"
{
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{8AB635F8-9A67-4698-AB99-784AD929F3B4}" -Force -ErrorAction Ignore
}
}
}
}
<#
.SYNOPSIS
The "Print" item in the .bat and .cmd context menu
@ -12919,12 +12977,12 @@ function UpdateLGPEPolicies
{
# Parse every ADMX template searching if it contains full path and registry key simultaneously
[xml]$config = Get-Content -Path $admx.FullName -Encoding UTF8
$config.SelectNodes("//@*") | ForEach-Object {$_.value = $_.value.ToLower()}
$config.SelectNodes("//@*") | ForEach-Object -Process {$_.value = $_.value.ToLower()}
$SplitPath = $Path.Name.Replace("HKEY_LOCAL_MACHINE\", "")
if ($config.SelectSingleNode("//*[local-name()='policy' and @key='$($SplitPath.ToLower())' and (@valueName='$($Item.ToLower())' or @Name='$($Item.ToLower())' or .//*[local-name()='enum' and @valueName='$($Item.ToLower())'])]"))
{
Write-Verbose -Message $Item.Replace("{}", "") -Verbose
Write-Verbose -Message ([string](($SplitPath, "|", $Item.Replace("{}", "")))) -Verbose
$Type = switch ((Get-Item -Path $Path.PSPath).GetValueKind($Item))
{
@ -12974,12 +13032,12 @@ function UpdateLGPEPolicies
{
# Parse every ADMX template searching if it contains full path and registry key simultaneously
[xml]$config = Get-Content -Path $admx.FullName -Encoding UTF8
$config.SelectNodes("//@*") | ForEach-Object {$_.value = $_.value.ToLower()}
$config.SelectNodes("//@*") | ForEach-Object -Process {$_.value = $_.value.ToLower()}
$SplitPath = $Path.Name.Replace("HKEY_CURRENT_USER\", "")
if ($config.SelectSingleNode("//*[local-name()='policy' and @key='$($SplitPath.ToLower())' and (@valueName='$($Item.ToLower())' or @Name='$($Item.ToLower())' or .//*[local-name()='enum' and @valueName='$($Item.ToLower())'])]"))
{
Write-Verbose -Message $Item.Replace("{}", "") -Verbose
Write-Verbose -Message ([string](($SplitPath, "|", $Item.Replace("{}", "")))) -Verbose
$Type = switch ((Get-Item -Path $Path.PSPath).GetValueKind($Item))
{
@ -13087,6 +13145,12 @@ public static void PostMessage()
}
}
if ($Script:RegionChanged)
{
# Set the original region ID
Set-WinHomeLocation -GeoId $Script:Region
}
# Persist Sophia notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia))
{
@ -13201,16 +13265,6 @@ public static void PostMessage()
gpupdate /force
}
# [WinAPI.UpdateEnvironment]::Refresh() makes so that Meet Now icon returns even if was hid before, so we need to check which function was called previously
if ($Script:MeetNow)
{
MeetNow -Show
}
elseif ($Script:MeetNow -eq $false)
{
MeetNow -Hide
}
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore

8
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -1274,6 +1274,14 @@ ShareContext -Hide
# Отобразить пункт "Отправить" (поделиться) в контекстном меню (значение по умолчанию)
# ShareContext -Show
# Hide the "Edit with Clipchamp" item from the media files context menu
# Скрыть пункт "Редактировать в Climpchamp" из контекстного меню
EditWithClipchampContext -Hide
# Show the "Edit with Clipchamp" item in the media files context menu (default value)
# Отобразить пункт "Редактировать в Climpchamp" в контекстном меню (значение по умолчанию)
# EditWithClipchampContext -Show
# Hide the "Print" item from the .bat and .cmd context menu
# Скрыть пункт "Печать" из контекстного меню .bat и .cmd файлов
PrintCMDContext -Hide

Loading…
Cancel
Save