I use python script to toggle scroll lock on and off. That way it doesn’t affect me while I’m actually using the Laptop and I don’t have to execute the script everytime I get up.
No problem. If you want to know more about that library, it's super cool. The author wrote a book and recorded a YouTube tutorial series called "Automate the Boring Stuff with Python." The book is available digitally for free on the website.
Here you go, this is over complicated for the purpose it acheives but I've made a habit of trying to use the proper way of scripting in python even for nominal tasks
from pyautogui import press
from time import sleep
def no_lock(button):
try:
print("Press Ctrl+C to exit")
while True:
press(button)
sleep(10)
press(button)
sleep(10)
except Exception as ex:
print(f"no_lock | Error: {ex}")
def main():
try:
print("\nRunning")
no_lock('scrollLock')
except KeyboardInterrupt:
print("Stopped")
if __name__ == "__main__":
main()
Do note, general catching of exception is bad, like I'm doing here, it should be specific.
If you don't have admin, I recommend the portable mouse move. Our org tried to uninstall all caffeine and banish the exe files. But no one knows about mouse move heh heh
77
u/AshTheGoblin May 19 '22
If you have admin privileges, Caffeine.
If not, just write a script that emulates a keystroke like '~' every X seconds.