Aspire R15 accidental shut down by unintentional power button press - remedy

RedeemerSK
RedeemerSK Member Posts: 1 New User
edited August 2023 in 2019 Archives
Hello
I don't really have a question, but rather I want to share a workaround I developed for the problem of accidentally shutting down the notebook by unintentionally pressing power button, that was happening to me often while using the device in tablet mode & portrait orientation - power button on the bottom got pressed easily just by resting the device on that edge.

I created a small script (VBscript for main functionality, Powershell script for showing notifications), that can detect when the OS switches to tablet mode, in which case it disables power-button action. Power button action is restored (to sleep) again when tablet mode is turned off. Script has to be running to do necessary job, but should not consume resources (CPU/battery) as it works by means of registering callback that is executed by OS when tablet mode is enabled/disabled. Other than that, script itself always just sleeps to avoid finishing to keep the registered callback active.

I also created install script (BAT file) to make it really easy for anybody to start using the above script - it installs necessary PowerShell module (for Win 10 toast notification), gathers necessary information from system & preference from user, prepares runtime scripts (applies gathered info), copies them to chosen directory and configures Windows task to start the script with logon of the user.

Script is available on https://1drv.ms/u/s!ArWUMeNtU3fZoi7EGcfz8hdjZDqG?e=4ANUxH .
In case link is removed from this post, 
It's all script, no binaries, so everybody can see what is being executed - if anybody has security concerns.

Cheers
Jozef

[Post edited to remove inappropriate or personal content -Acer-Harvey]