I was trying to manipulate the windows settings using the powershell. Below is the python code with which I try using powershell-commands to disable the taskbar (the automatically hide/show setting in this case) programatically.
import subprocess
def change_taskbar_visibility():
powershell_commands = [
'$regKeyPath = "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRects3"',
'$regValueName = "Settings"',
'$currentSettings = Get-ItemProperty -Path $regKeyPath -Name $regValueName',
'$currentSettings.Settings[8] = 2',
'Set-ItemProperty -Path $regKeyPath -Name $regValueName -Value $currentSettings.Settings',
'Stop-Process -Name explorer -Force'
]
cmd = ";".join(powershell_commands)
subprocess.run(["powershell", "-Command", cmd], shell=True)
if __name__ == "__main__":
change_taskbar_visibility()
However the taskbar only hides for a couple of seconds until it reappears again, so the changes I've made didn't stay. Do I have to modify my code to make it work or is there somethin in the os I need to change?