Можно ли написать скрипт, чтобы снимать фалочку выключать все ненужные анимации, когда можно можно?

Whenever I use remote desktop to get into my computer at work, I always have to go to the:

control panel -> ease of access center -> make the computer easier to see

Is there a way to write a script (batch or powershell) to uncheck that checkbox?

Giacomo1968's user avatar

23 gold badges167 silver badges214 bronze badges

asked Oct 8, 2023 at 3:30

Raintan's user avatar

Is there a way to write a script (batch or powershell) to uncheck that checkbox?


Set-ItemProperty -Path "HKCU:Control Panel\Desktop" -Name UserPreferencesMask -Value ([byte[]](0x90,0x12,0x03,0x80,0x10,0x00,0x00,0x00))

@echo off
set "_hKey="HKEY_CURRENT_USER\Control Panel\Desktop" /v UserPreferencesMask"
reg query %_hKey% | find "%_vhex%" >nul || reg add %_hKey% /t Reg_Binary /d "9E2C078010000000" /f

reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v UserPreferencesMask /t REG_BINARY /d "9E2C078010000000" /f

answered Oct 8, 2023 at 11:36

Io-oI's user avatar

3 gold badges13 silver badges41 bronze badges

One post
lists these registry settings:

there are 2 registry values involved:

This is a reg_binary value. Change this value from 9E 2C 07 80 12 00 00 00 to 9E 2C 07 80 10 00 00 00.

The VisualEffects key doesn’t exist by default. There are a bunch of
values that can be defined under here but the only one that really
matters is VisualFxSettings. Set this to 2 to disable a lot of the
animations and also to tick “Turn off all unnecessary animations (when
possible)” .

Take care when updating the registry.

answered Oct 8, 2023 at 10:07

harrymc's user avatar

Please help 🙁

My understanding is i need to modify the $checkListBox.add_ItemCheck event handler, but i can’t wrap my brain around how i would do that, whilst retaining the existing behaviour.

Add-Type -AssemblyName System.Windows.Forms
$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object System.Drawing.Size(300, 200)
$checkListBox = New-Object System.Windows.Forms.CheckedListBox
$checkListBox.Location = New-Object System.Drawing.Point(10, 10)
$checkListBox.Size = New-Object System.Drawing.Size(200, 150)
# Add items to the checkListBox
$checkListBox.Items.Add("Option 1") | Out-Null
$checkListBox.Items.Add("Option 2") | Out-Null
$checkListBox.Items.Add("Option 3") | Out-Null
$checkListBox.SelectionMode = 'One'
$checkListBox.CheckOnClick = $true
$checkListBox.SetItemChecked(0, $true) # set the first item by default.
# Add ItemCheck event handler
$checkListBox.add_ItemCheck({ param($sender, $e) foreach ($index in $checkListBox.CheckedIndices) { if ($index -ne $e.Index) { $checkListBox.SetItemChecked($index, $false) } }
})
$form.Controls.Add($checkListBox)
$form.ShowDialog() | Out-Null

Example of me running the above code

Add-Type -AssemblyName System.Windows.Forms
$form = New-Object System.Windows.Forms.Form
$form.Size = New-Object System.Drawing.Size(300, 200)
$checkListBox = New-Object System.Windows.Forms.CheckedListBox
$checkListBox.Location = New-Object System.Drawing.Point(10, 10)
$checkListBox.Size = New-Object System.Drawing.Size(200, 150)
("Option 1","Option 2","Option 3") | % {$checkListBox.Items.Add("$_") | Out-Null}
$checkListBox.SelectionMode = 'One'
$checkListBox.CheckOnClick = $true
$checkListBox.SetItemChecked(0, $true) # set the first item by default.
$handlingEvent = $false
$checkListBox.add_ItemCheck({ param($sender, $e) if ($handlingEvent) { return } $handlingEvent = $true try { $currentCheckedState = [System.Windows.Forms.CheckState]::Unchecked $newCheckedState = [System.Windows.Forms.CheckState]::Unchecked if ($e.CurrentValue -eq 1) { $currentCheckedState = [System.Windows.Forms.CheckState]::Checked } if ($e.NewValue -eq 1) { $newCheckedState = [System.Windows.Forms.CheckState]::Checked } if ($currentCheckedState -eq [System.Windows.Forms.CheckState]::Checked -and $newCheckedState -eq [System.Windows.Forms.CheckState]::Unchecked) { $e.NewValue = [System.Windows.Forms.CheckState]::Checked } $checkListBox.CheckedIndices | ForEach-Object { if ($_ -ne $e.Index) { $checkListBox.SetItemChecked($_, $false) } } } finally { $handlingEvent = $false }
})
$form.Controls.Add($checkListBox)
# Show the form, but since we only seem to get "cancel" in the resultant object, no point keeping it. we only care what checkbox they selected..
$form.ShowDialog() | out-null
# Output the result
$DialogOut = $checkListBox.CheckedItems
Write-host "User Selected: $DialogOut"