Настройка визуальных эффектов Windows 10 [closed]

У меня вопрос Может ли кто-нибудь сказать мне, что я сделал не так, что после использования скрипта вместо получения этого эффекта
ожидаемый эффект

получает эти настройки

текущий эффект

using namespace System
using namespace Microsoft.Win32
#Requires -Version 5.1

[OutputType([void])]
param (
    # TODO: Animate controls and elements inside windows
    [switch] $AnimateControls,

    # TODO: Animate Windows when minimizing or maximizing
    [switch] $AnimateWindows,

    # Animation in the taskbar
    [switch] $AnimateTaskbar,

    # Enable Peek
    [switch] $EnablePeek,

    # TODO: Fade or slide menus into view
    [switch] $FadeSlideMenu,

    # TODO: Fade or slide ToolTips into view
    [switch] $FadeSlideTooltips,

    # TODO: Fade out menu items after clicking (reboot)
    [switch] $FadeMenuItemsClick,

    # Save taskbar thumbnail previews
    [switch] $TaskbarThumbnails,

    # TODO: Show shadows under mouse pointer (reboot)
    [switch] $ShadowsMousePointer,

    # TODO: Show shadows under windows (reboot)
    [switch] $ShadowsWindows,

    # TODO: Show thumbnails instead of icons
    [switch] $ThumbnailsNoIcons,

    # Show translucent selection rectangle
    [switch] $TranslucentSelection,

    # TODO: Show window contents while dragging (reboot)
    [switch] $WindowContents,

    # TODO: Slide open combo boxes
    [switch] $SlideOpenCombo,

    # TODO: Smooth edges of screen fonts (reboot)
    [switch] $ScreenFonts,

    # TODO: Smooth-scroll list boxes
    [switch] $SmoothListBox,

    # Use drop shadows for icon labels on the desktop
    [switch] $DropShadows
)

if ([Environment]::Is64BitOperatingSystem)
{
    $RegistryView = [RegistryView]::Registry64
}
else
{
    $RegistryView = [RegistryView]::Registry32
}

$RegistryHive = [RegistryHive]::CurrentUser

Write-Verbose -Message $("Open registry hive -> " + $RegistryHive.ToString())
$RootKey = [RegistryKey]::OpenBaseKey($RegistryHive, $RegistryView)

if (!$RootKey)
{
    Write-Error -TargetObject $RegistryHive -Category OpenError `
        -Message $("Failed to open registry hive -> " + $RegistryHive.ToString())
    exit
}

$Permission = [RegistryKeyPermissionCheck]::ReadWriteSubTree
$Rights = [System.Security.AccessControl.RegistryRights] "SetValue, QueryValues"

# Set default option
$KeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionExplorerVisualEffects"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights);
$RegKey.SetValue("VisualFXSetting", 3, [RegistryValueKind]::DWord)

$KeyPath = "Control PanelDesktop"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights)

if ($WindowContents)
{
    $RegKey.SetValue("DragFullWindows", 1, [RegistryValueKind]::String)
}

#region UserPreferences
[byte[]] $Preference = $RegKey.GetValue("UserPreferencesMask")

$mask = 0x8 # 0000 1000
$Preference[0] = if ($SmoothListBox)
{
    # 146 -> 154
    # 1001 0010
    # 1001 1010
    $Preference[0] -bor $mask
}
else
{
    $Preference[0] -band -bnot $mask
}

$mask = 0x4 # 0000 0100
$Preference[0] = if ($SlideOpenCombo)
{
    $Preference[0] -bor 0x4
}
else
{
    $Preference[0] -band -bnot 0x4
}

$mask = 0x2 # 0000 0010
$Preference[0] = if ($FadeSlideMenu)
{
    $Preference[0] -bor $mask
}
else
{
    $Preference[0] -band -bnot $mask
}

$mask = 0x20 # 0010 0000
$Preference[1] = if ($ShadowsMousePointer)
{
    $Preference[1] -bor $mask
}
else
{
    $Preference[1] -band -bnot $mask
}

$mask = 0x8 # 0000 1000
$Preference[1] = if ($FadeSlideTooltips)
{
    $Preference[1] -bor $mask
}
else
{
    $Preference[1] -band -bnot $mask
}

$mask = 0x4 # 0000 0100
$Preference[1] = if ($FadeMenuItemsClick)
{
    $Preference[1] -bor $mask
}
else
{
    $Preference[1] -band -bnot $mask
}

$mask = 0x4 # 0000 0100
$Preference[2] = if ($ShadowsWindows)
{
    $Preference[2] -bor $mask
}
else
{
    $Preference[2] -band -bnot $mask
}

$mask = 0x2 # 0000 0010
$Preference[4] = if ($AnimateControls)
{
    # 9E 3E 07 80 12 00 00 00
    # 10011110 00111110 00000111 10000000 00010010 00000000 00000000 00000000

    # 9E 3E 07 80 10 00 00 00
    # 10011110 00111110 00000111 10000000 00010000 00000000 00000000 00000000
    $Preference[4] -bor $mask
}
else
{
    $Preference[4] -band -bnot $mask
}

$RegKey.SetValue("UserPreferencesMask", $Preference, [RegistryValueKind]::Binary)
#endregion

if ($ScreenFonts)
{
    $RegKey.SetValue("FontSmoothing", 2, [RegistryValueKind]::String)
}

$KeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionExplorer"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights)
[byte[]] $ShellState = $RegKey.GetValue("ShellState")

$mask = 0x10 # 0001 0000
$ShellState[32] = if ($ThumbnailsNoIcons)
{
    # byte 33 enable = 114 -> 98
    # 0111 0010
    # 0110 0010
    $ShellState[32] -band -bnot $mask
}
else
{
    $ShellState[32] -bor $mask
}

$RegKey.SetValue("ShellState", $ShellState, [RegistryValueKind]::Binary)

$KeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionExplorerAdvanced"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights)

if ($DropShadows)
{
    $RegKey.SetValue("ListviewShadow", 1, [RegistryValueKind]::DWord)
}

if ($AnimateTaskbar)
{
    $RegKey.SetValue("TaskbarAnimations", 1, [RegistryValueKind]::DWord)
}

if ($ThumbnailsNoIcons)
{
    $RegKey.SetValue("Hidden", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("ShowCompColor", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("HideFileExt", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("DontPrettyPath", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("ShowInfoTip", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("HideIcons", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("MapNetDrvBtn", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("WebView", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("Filter", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("ShowSuperHidden", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("SeparateProcess", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("AutoCheckSelect", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("IconsOnly", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("ShowTypeOverlay", 1, [RegistryValueKind]::DWord)
    $RegKey.SetValue("ShowStatusBar", 1, [RegistryValueKind]::DWord)
}

if ($TranslucentSelection)
{
    $RegKey.SetValue("ListviewAlphaSelect", 1, [RegistryValueKind]::DWord)
}

$KeyPath = "Control PanelDesktopWindowMetrics"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights)

if ($AnimateWindows)
{
    $RegKey.SetValue("MinAnimate", 1, [RegistryValueKind]::String)
}

$KeyPath = "SOFTWAREMicrosoftWindowsDWM"
$RegKey = $RootKey.OpenSubkey($KeyPath, $Permission, $Rights)

if ($EnablePeek)
{
    $RegKey.SetValue("EnableAeroPeek", 1, [RegistryValueKind]::DWord)
}

if ($TaskbarThumbnails)
{
    $RegKey.SetValue("AlwaysHibernateThumbnails", 1, [RegistryValueKind]::DWord)
}

# TODO: Helper function to edit binary value
function Set-Binary
{
    param (
        [ref] $Byte,
        [uint16] $Mask,
        [switch] $Enable
    )

    $Byte.Value = if ($Enable)
    {
        $Byte.Value -bor $mask
    }
    else
    {
        $Byte.Value -band -bnot $mask
    }
}

# TODO: Helper function to print binary representation
function Write-Bits
{
    param (
        [byte[]] $Data
    )

    foreach ($Byte in $Data)
    {
        [Convert]::ToString($Byte, 2)
    }
}

0

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *